Changeset 195681 in webkit
- Timestamp:
- Jan 27, 2016 12:08:52 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r195678 r195681 1 2016-01-26 Ryosuke Niwa <rniwa@webkit.org> 2 3 Rename HTMLSlotElement.getDistributedNodes to getAssignedNodes 4 https://bugs.webkit.org/show_bug.cgi?id=153534 5 6 Reviewed by Antti Koivisto. 7 8 Updated the tests to refect the rename. Also added test cases after r192763 9 to assert we don't assign comment and processing instruction nodes to a slot. 10 11 * fast/shadow-dom/HTMLSlotElement-interface-expected.txt: 12 * fast/shadow-dom/HTMLSlotElement-interface.html: 13 * fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html: 14 1 15 2016-01-27 Tim Horton <timothy_horton@apple.com> 2 16 -
trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface-expected.txt
r190323 r195681 2 2 PASS HTMLSlotElement must be defined on window 3 3 PASS "name" attribute on HTMLSlotElement must reflect "name" attribute 4 PASS get DistributedNodes method on HTMLSlotElement must return the list of distributed nodes5 PASS get DistributedNodes must update when slot and name attributes are modified6 PASS get DistributedNodes must update when a default slot is introduced dynamically by a slot rename7 PASS get DistributedNodes must update when slot elements are inserted or removed4 PASS getAssignedNodes method on HTMLSlotElement must return the list of distributed nodes 5 PASS getAssignedNodes must update when slot and name attributes are modified 6 PASS getAssignedNodes must update when a default slot is introduced dynamically by a slot rename 7 PASS getAssignedNodes must update when slot elements are inserted or removed 8 8 -
trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface.html
r190323 r195681 4 4 <title>Shadow DOM: HTMLSlotElement interface</title> 5 5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"> 6 <meta name="assert" content="HTMLSlotElement must exist on window with name attribute and get DistributedNodes() method">6 <meta name="assert" content="HTMLSlotElement must exist on window with name attribute and getAssignedNode() method"> 7 7 <link rel="help" href="https://w3c.github.io/webcomponents/spec/shadow/#the-slot-element"> 8 8 <script src="../../resources/testharness.js"></script> … … 36 36 37 37 test(function () { 38 assert_true('get DistributedNodes' in HTMLSlotElement.prototype, '"getDistributedNodes" method must be defined on HTMLSlotElement.prototype');38 assert_true('getAssignedNodes' in HTMLSlotElement.prototype, '"getAssignedNodes" method must be defined on HTMLSlotElement.prototype'); 39 39 40 40 var shadowHost = document.createElement('div'); … … 45 45 shadowRoot.appendChild(slotElement); 46 46 47 assert_array_equals(slotElement.get DistributedNodes(), [], 'getDistributedNodes must return an empty array when there are no nodes in the shadow tree');47 assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes must return an empty array when there are no nodes in the shadow tree'); 48 48 49 49 shadowHost.appendChild(child); 50 assert_array_equals(slotElement.get DistributedNodes(), [child], 'getDistributedNodes on a default slot must return an element without slot element');50 assert_array_equals(slotElement.getAssignedNodes(), [child], 'getAssignedNodes on a default slot must return an element without slot element'); 51 51 52 52 child.setAttribute('slot', 'foo'); 53 assert_array_equals(slotElement.get DistributedNodes(), [], 'getDistributedNodes on a default slot must not return an element with non-empty slot attribute');53 assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes on a default slot must not return an element with non-empty slot attribute'); 54 54 55 55 child.setAttribute('slot', ''); 56 assert_array_equals(slotElement.get DistributedNodes(), [child], 'getDistributedNodes on a default slot must return an element with empty slot attribute');56 assert_array_equals(slotElement.getAssignedNodes(), [child], 'getAssignedNodes on a default slot must return an element with empty slot attribute'); 57 57 58 58 slotElement.setAttribute('name', 'bar'); 59 assert_array_equals(slotElement.get DistributedNodes(), [], 'getDistributedNodes on a named slot must not return an element with empty slot attribute');59 assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes on a named slot must not return an element with empty slot attribute'); 60 60 61 61 slotElement.setAttribute('name', ''); 62 assert_array_equals(slotElement.get DistributedNodes(), [child], 'getDistributedNodes on an empty name slot must return an element with empty slot attribute');62 assert_array_equals(slotElement.getAssignedNodes(), [child], 'getAssignedNodes on an empty name slot must return an element with empty slot attribute'); 63 63 64 }, 'get DistributedNodes method on HTMLSlotElement must return the list of distributed nodes');64 }, 'getAssignedNodes method on HTMLSlotElement must return the list of distributed nodes'); 65 65 66 66 test(function () { … … 75 75 shadowRoot.appendChild(slotElement); 76 76 77 assert_array_equals(slotElement.get DistributedNodes(), [p, b], 'getDistributedNodes must return the distributed nodes');77 assert_array_equals(slotElement.getAssignedNodes(), [p, b], 'getAssignedNodes must return the distributed nodes'); 78 78 79 79 slotElement.name = 'foo'; 80 assert_array_equals(slotElement.get DistributedNodes(), [], 'getDistributedNodes must be empty when there are no matching elements for the slot name');80 assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes must be empty when there are no matching elements for the slot name'); 81 81 82 82 b.slot = 'foo'; 83 assert_array_equals(slotElement.get DistributedNodes(), [b], 'getDistributedNodes must return the nodes with the matching slot name');83 assert_array_equals(slotElement.getAssignedNodes(), [b], 'getAssignedNodes must return the nodes with the matching slot name'); 84 84 85 85 p.slot = 'foo'; 86 assert_array_equals(slotElement.get DistributedNodes(), [p, b], 'getDistributedNodes must return the nodes with the matching slot name in the tree order');86 assert_array_equals(slotElement.getAssignedNodes(), [p, b], 'getAssignedNodes must return the nodes with the matching slot name in the tree order'); 87 87 88 88 slotElement.name = null; 89 assert_array_equals(slotElement.get DistributedNodes(), [], 'getDistributedNodes must be empty for a default slot when all elements have "slot" attributes specified');89 assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes must be empty for a default slot when all elements have "slot" attributes specified'); 90 90 91 }, 'get DistributedNodes must update when slot and name attributes are modified');91 }, 'getAssignedNodes must update when slot and name attributes are modified'); 92 92 93 93 test(function () { … … 101 101 shadowRoot.appendChild(slotElement); 102 102 103 assert_array_equals(slotElement.get DistributedNodes(), [], 'getDistributedNodes must be empty when there are no matching elements for the slot name');103 assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes must be empty when there are no matching elements for the slot name'); 104 104 105 105 slotElement.name = null; 106 assert_array_equals(slotElement.get DistributedNodes(), [child], 'getDistributedNodes must be empty when there are no matching elements for the slot name');106 assert_array_equals(slotElement.getAssignedNodes(), [child], 'getAssignedNodes must be empty when there are no matching elements for the slot name'); 107 107 108 }, 'get DistributedNodes must update when a default slot is introduced dynamically by a slot rename');108 }, 'getAssignedNodes must update when a default slot is introduced dynamically by a slot rename'); 109 109 110 110 test(function () { … … 112 112 var p = document.createElement('p'); 113 113 var text = document.createTextNode(''); 114 var comment = document.createComment(''); 115 var processingInstruction = document.createProcessingInstruction('target', 'data'); 114 116 var b = document.createElement('b'); 115 117 shadowHost.appendChild(p); 116 118 shadowHost.appendChild(text); 119 shadowHost.appendChild(comment); 120 shadowHost.appendChild(processingInstruction); 117 121 shadowHost.appendChild(b); 118 122 … … 125 129 shadowRoot.appendChild(secondSlotElement); 126 130 127 assert_array_equals(firstSlotElement.get DistributedNodes(), [p, text, b],128 'get DistributedNodes on a default slot must return the elements without slot attributes and text nodes');129 assert_array_equals(secondSlotElement.get DistributedNodes(), [],130 'get DistributedNodes on the second unnamed slot element must return an empty array');131 assert_array_equals(firstSlotElement.getAssignedNodes(), [p, text, b], 132 'getAssignedNodes on a default slot must return the elements without slot attributes and text nodes'); 133 assert_array_equals(secondSlotElement.getAssignedNodes(), [], 134 'getAssignedNodes on the second unnamed slot element must return an empty array'); 131 135 132 136 shadowRoot.removeChild(firstSlotElement); 133 assert_array_equals(firstSlotElement.get DistributedNodes(), [],134 'get DistributedNodes on a detached formerly-default slot must return an empty array');135 assert_array_equals(secondSlotElement.get DistributedNodes(), [p, text, b],136 'get DistributedNodes on the second unnamed slot element after removing the first must return the elements without slot attributes and text nodes');137 assert_array_equals(firstSlotElement.getAssignedNodes(), [], 138 'getAssignedNodes on a detached formerly-default slot must return an empty array'); 139 assert_array_equals(secondSlotElement.getAssignedNodes(), [p, text, b], 140 'getAssignedNodes on the second unnamed slot element after removing the first must return the elements without slot attributes and text nodes'); 137 141 138 142 shadowRoot.removeChild(secondSlotElement); 139 143 shadowRoot.appendChild(secondSlotElement); 140 assert_array_equals(firstSlotElement.get DistributedNodes(), [],141 'Removing and re-inserting a default slot must not change the result of get DistributedNodes on a detached slot');142 assert_array_equals(secondSlotElement.get DistributedNodes(), [p, text, b],143 'Removing and re-inserting a default slot must not change the result of get DistributedNodes');144 assert_array_equals(firstSlotElement.getAssignedNodes(), [], 145 'Removing and re-inserting a default slot must not change the result of getAssignedNodes on a detached slot'); 146 assert_array_equals(secondSlotElement.getAssignedNodes(), [p, text, b], 147 'Removing and re-inserting a default slot must not change the result of getAssignedNodes'); 144 148 145 149 shadowRoot.insertBefore(firstSlotElement, secondSlotElement); 146 assert_array_equals(firstSlotElement.get DistributedNodes(), [p, text, b],147 'get DistributedNodes on a newly inserted unnamed slot element must return the elements without slot attributes and text nodes');148 assert_array_equals(secondSlotElement.get DistributedNodes(), [],149 'get DistributedNodes on formerly-first but now second unnamed slot element must return an empty array');150 assert_array_equals(firstSlotElement.getAssignedNodes(), [p, text, b], 151 'getAssignedNodes on a newly inserted unnamed slot element must return the elements without slot attributes and text nodes'); 152 assert_array_equals(secondSlotElement.getAssignedNodes(), [], 153 'getAssignedNodes on formerly-first but now second unnamed slot element must return an empty array'); 150 154 151 }, 'get DistributedNodes must update when slot elements are inserted or removed');155 }, 'getAssignedNodes must update when slot elements are inserted or removed'); 152 156 153 157 </script> -
trunk/LayoutTests/fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html
r189950 r195681 59 59 shadowHost.appendChild(childTextNode); 60 60 61 var commentNode = document.create TextNode('');61 var commentNode = document.createComment(''); 62 62 shadowHost.appendChild(commentNode); 63 64 var processingInstructionNode = document.createProcessingInstruction('target', 'data'); 65 shadowHost.appendChild(processingInstructionNode); 63 66 64 67 var shadowRoot = shadowHost.attachShadow({mode: 'open'}); … … 68 71 assert_equals(childElement.assignedSlot, slot, 'assignedSlot on an element must return the assigned default slot element'); 69 72 assert_equals(childTextNode.assignedSlot, slot, 'assignedSlot on a text node must return the assigned default slot element'); 70 assert_equals(commentNode.assignedSlot, slot, 'assignedSlot on a comment node must return the assigned default slot element'); 73 assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a comment node must always return null'); 74 assert_equals(processingInstructionNode.assignedSlot, null, 'assignedSlot on a comment node must always return null'); 71 75 72 76 slot.name = 'foo'; … … 74 78 assert_equals(childTextNode.assignedSlot, null, 'assignedSlot on a text node must null when the node is unassigned from a slot element'); 75 79 assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a text node must null when the node is unassigned from a slot element'); 80 assert_equals(processingInstructionNode.assignedSlot, null, 'assignedSlot on a text node must null when the node is unassigned from a slot element'); 76 81 77 82 childElement.slot = 'foo'; … … 80 85 slot.name = null; 81 86 assert_equals(childTextNode.assignedSlot, slot, 'assignedSlot on a text node must return the re-assigned slot element'); 82 assert_equals(commentNode.assignedSlot, slot, 'assignedSlot on a comment node must return the re-assigned slot element'); 87 assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a comment node must always return null'); 88 assert_equals(processingInstructionNode.assignedSlot, null, 'assignedSlot on a comment node must always return null'); 83 89 84 90 }, 'assignedSlot must return the assigned slot'); … … 95 101 shadowHost.appendChild(commentNode); 96 102 103 var processingInstructionNode = document.createProcessingInstruction('target', 'data'); 104 shadowHost.appendChild(processingInstructionNode); 105 97 106 var shadowRoot = shadowHost.attachShadow({mode: 'closed'}); 98 107 var slot = document.createElement('slot'); 99 108 shadowRoot.appendChild(slot); 100 109 101 assert_equals(childElement.assignedSlot, null, 'assignedSlot on an element must return the assigned slot element.'); 102 assert_equals(childTextNode.assignedSlot, null, 'assignedSlot on a text node must return the assigned slot element.'); 103 assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a comment node must return the assigned slot element.'); 110 assert_equals(childElement.assignedSlot, null, 'assignedSlot on an element must return null if the slot is inside a closed shadow tree.'); 111 assert_equals(childTextNode.assignedSlot, null, 'assignedSlot on a text node must return null if the slot is inside a closed shadow tree.'); 112 assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a comment node must always return null.'); 113 assert_equals(processingInstructionNode.assignedSlot, null, 'assignedSlot on a processing instruction must always return null.'); 104 114 105 115 }, 'assignedSlot must return null when the assigned slot element is inside a closed shadow tree'); -
trunk/Source/WebCore/ChangeLog
r195678 r195681 1 2016-01-26 Ryosuke Niwa <rniwa@webkit.org> 2 3 Rename HTMLSlotElement.getDistributedNodes to getAssignedNodes 4 https://bugs.webkit.org/show_bug.cgi?id=153534 5 6 Reviewed by Antti Koivisto. 7 8 Did the rename. 9 10 * html/HTMLSlotElement.idl: 11 1 12 2016-01-27 Tim Horton <timothy_horton@apple.com> 2 13 -
trunk/Source/WebCore/html/HTMLSlotElement.idl
r190093 r195681 31 31 32 32 [Reflect] attribute DOMString name; 33 [ImplementedAs=assignedNodes] sequence<Node> get DistributedNodes();33 [ImplementedAs=assignedNodes] sequence<Node> getAssignedNodes(); 34 34 35 35 };
Note: See TracChangeset
for help on using the changeset viewer.