Skip to content

Commit

Permalink
remove open TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
pmdartus committed Oct 14, 2019
1 parent 0ec894b commit b79a423
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 41 deletions.
43 changes: 16 additions & 27 deletions lib/jsdom/living/helpers/custom-elements.js
Expand Up @@ -132,9 +132,6 @@ function upgradeElement(definition, element) {
element._ceDefinition = null;
element._ceReactionQueue = [];

// TODO: Verify if it should report an error instead of throwing.
// See Document-createElement.html:
// - document.createElement must report an exception thrown by a custom built-in element constructor
throw constructionError;
}

Expand Down Expand Up @@ -185,32 +182,24 @@ function lookupCEDefinition(document, namespace, localName, isValue) {
// https://html.spec.whatwg.org/multipage/custom-elements.html#invoke-custom-element-reactions
function invokeCEReactions(elementQueue) {
for (const element of elementQueue) {
// TODO: Open spec bug, the element custom element state can either be "custom" or "undefined" is the element is
// pending for upgrade. The spec only consider the "custom" and the "uncustomized" case.
if (
element._ceState === CUSTOM_ELEMENT_STATE.CUSTOM ||
element._ceState === CUSTOM_ELEMENT_STATE.UNDEFINED ||
element._ceState === CUSTOM_ELEMENT_STATE.UNCUSTOMIZED
) {
const reactions = element._ceReactionQueue;

try {
while (reactions.length > 0) {
const reaction = reactions.shift();

switch (reaction.type) {
case "upgrade":
upgradeElement(reaction.definition, element);
break;

case "callback":
reaction.callback.apply(wrapperForImpl(element), reaction.args);
break;
}
const reactions = element._ceReactionQueue;

try {
while (reactions.length > 0) {
const reaction = reactions.shift();

switch (reaction.type) {
case "upgrade":
upgradeElement(reaction.definition, element);
break;

case "callback":
reaction.callback.apply(wrapperForImpl(element), reaction.args);
break;
}
} catch (error) {
reportException(element._ownerDocument._defaultView, error);
}
} catch (error) {
reportException(element._ownerDocument._defaultView, error);
}
}
}
Expand Down
22 changes: 9 additions & 13 deletions lib/jsdom/living/nodes/Node-impl.js
Expand Up @@ -948,22 +948,18 @@ class NodeImpl extends EventTargetImpl {
nodeImpl._detach();
this._descendantRemoved(this, nodeImpl);

// TODO: Open spec bug here.
// The disconnectCallback should not be invoked in the parent element is not connected.
if (this.isConnected) {
if (nodeImpl._ceState === CUSTOM_ELEMENT_STATE.CUSTOM) {
enqueueCECallbackReaction(nodeImpl, "disconnectedCallback", []);
}
if (nodeImpl._ceState === CUSTOM_ELEMENT_STATE.CUSTOM) {
enqueueCECallbackReaction(nodeImpl, "disconnectedCallback", []);
}

for (const descendantImpl of shadowIncludingDescendantsIterator(nodeImpl)) {
if (descendantImpl._ceState === CUSTOM_ELEMENT_STATE.CUSTOM) {
enqueueCECallbackReaction(descendantImpl, "disconnectedCallback", []);
}
for (const descendantImpl of shadowIncludingDescendantsIterator(nodeImpl)) {
if (descendantImpl._ceState === CUSTOM_ELEMENT_STATE.CUSTOM) {
enqueueCECallbackReaction(descendantImpl, "disconnectedCallback", []);
}
}

if (!suppressObservers) {
queueTreeMutationRecord(this, [], [nodeImpl], oldPreviousSiblingImpl, oldNextSiblingImpl);
}
if (!suppressObservers) {
queueTreeMutationRecord(this, [], [nodeImpl], oldPreviousSiblingImpl, oldNextSiblingImpl);
}

if (nodeImpl.nodeType === NODE_TYPE.TEXT_NODE) {
Expand Down
2 changes: 1 addition & 1 deletion test/web-platform-tests/to-run.yaml
Expand Up @@ -137,7 +137,7 @@ reactions/Range.html: [fail, Range is not implemented, https://github.com/jsdom/
reactions/Selection.html: [fail, Selection is not implemented, https://github.com/jsdom/jsdom/issues/937]
throw-on-dynamic-markup-insertion-counter-construct.html: [timeout, Document.write implementation is not spec compliant]
throw-on-dynamic-markup-insertion-counter-reactions.html: [timeout, Document.write implementation is not spec compliant]
upgrading/Document-importNode.html: [fail, HTMLElement constructor is patched for each window and is different than the one used via createElement, TODO]
upgrading/Document-importNode.html: [fail, HTMLElement constructor is patched for each window and is different than the one used via createElement]

---

Expand Down

0 comments on commit b79a423

Please sign in to comment.