WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-106616-20130110165257.patch (text/plain), 25.63 KB, created by
Arko Saha
on 2013-01-10 16:55:54 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Arko Saha
Created:
2013-01-10 16:55:54 PST
Size:
25.63 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 139385) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,52 @@ >+2013-01-10 Arko Saha <arko@motorola.com> >+ >+ Microdata: itemtype attribute must update correctly on adding or removing tokens >+ https://bugs.webkit.org/show_bug.cgi?id=106616 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a new class MicroDataAttributeTokenList, it overrides setValue() method of >+ DOMSettableTokenList. setValue() is responsible to set the new attribute value for >+ a given element. >+ >+ Tests: fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens.html >+ fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens.html >+ fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens.html >+ >+ * CMakeLists.txt: >+ * GNUmakefile.list.am: >+ * Target.pri: >+ * WebCore.gypi: >+ * WebCore.vcproj/WebCore.vcproj: >+ * dom/Node.cpp: >+ (WebCore::Node::itemProp): >+ (WebCore::Node::setItemProp): >+ (WebCore::Node::itemRef): >+ (WebCore::Node::setItemRef): >+ (WebCore::Node::itemType): >+ (WebCore::Node::setItemType): >+ * dom/NodeRareData.h: >+ (WebCore): >+ (NodeMicroDataTokenLists): >+ (WebCore::NodeRareData::itemProp): Changed function signature to accept a Node. >+ (WebCore::NodeRareData::setItemProp): ditto. >+ (WebCore::NodeRareData::itemRef): >+ (WebCore::NodeRareData::setItemRef): >+ (WebCore::NodeRareData::itemType): >+ (WebCore::NodeRareData::setItemType): >+ * html/DOMSettableTokenList.h: >+ (DOMSettableTokenList): Made the constructor as protected, so that we can override >+ setValue() method. >+ * html/MicroDataAttributeTokenList.cpp: Added. >+ (WebCore): >+ (WebCore::MicroDataAttributeTokenList::MicroDataAttributeTokenList): >+ (WebCore::MicroDataAttributeTokenList::setValue): >+ (WebCore::MicroDataAttributeTokenList::resetValue): >+ * html/MicroDataAttributeTokenList.h: Added. >+ (WebCore): >+ (MicroDataAttributeTokenList): >+ (WebCore::MicroDataAttributeTokenList::create): >+ > 2013-01-10 James Robinson <jamesr@chromium.org> > > [chromium] Store scrollable layer's contents size for coordinated scrollable layers >Index: Source/WebCore/CMakeLists.txt >=================================================================== >--- Source/WebCore/CMakeLists.txt (revision 139385) >+++ Source/WebCore/CMakeLists.txt (working copy) >@@ -1464,6 +1464,7 @@ set(WebCore_SOURCES > html/MediaController.cpp > html/MediaDocument.cpp > html/MediaFragmentURIParser.cpp >+ html/MicroDataAttributeTokenList.cpp > html/MicroDataItemValue.cpp > html/MonthInputType.cpp > html/NumberInputType.cpp >Index: Source/WebCore/GNUmakefile.list.am >=================================================================== >--- Source/WebCore/GNUmakefile.list.am (revision 139385) >+++ Source/WebCore/GNUmakefile.list.am (working copy) >@@ -3520,6 +3520,8 @@ webcore_sources += \ > Source/WebCore/html/MediaKeyEvent.h \ > Source/WebCore/html/MediaFragmentURIParser.cpp \ > Source/WebCore/html/MediaFragmentURIParser.h \ >+ Source/WebCore/html/MicroDataAttributeTokenList.cpp \ >+ Source/WebCore/html/MicroDataAttributeTokenList.h \ > Source/WebCore/html/MicroDataItemValue.cpp \ > Source/WebCore/html/MicroDataItemValue.h \ > Source/WebCore/html/MonthInputType.cpp \ >Index: Source/WebCore/Target.pri >=================================================================== >--- Source/WebCore/Target.pri (revision 139385) >+++ Source/WebCore/Target.pri (working copy) >@@ -676,6 +676,7 @@ SOURCES += \ > html/LabelsNodeList.cpp \ > html/LinkRelAttribute.cpp \ > html/MediaDocument.cpp \ >+ html/MicroDataAttributeTokenList.cpp \ > html/MicroDataItemValue.cpp \ > html/MonthInputType.cpp \ > html/NumberInputType.cpp \ >@@ -1867,6 +1868,7 @@ HEADERS += \ > html/MediaController.h \ > html/MediaDocument.h \ > html/MediaFragmentURIParser.h \ >+ html/MicroDataAttributeTokenList.h \ > html/MicroDataItemValue.h \ > html/PluginDocument.h \ > html/PublicURLManager.h \ >Index: Source/WebCore/WebCore.gypi >=================================================================== >--- Source/WebCore/WebCore.gypi (revision 139385) >+++ Source/WebCore/WebCore.gypi (working copy) >@@ -3211,6 +3211,8 @@ > 'html/MediaKeyError.h', > 'html/MediaKeyEvent.cpp', > 'html/MediaKeyEvent.h', >+ 'html/MicroDataAttributeTokenList.cpp', >+ 'html/MicroDataAttributeTokenList.h', > 'html/MicroDataItemValue.cpp', > 'html/MicroDataItemValue.h', > 'html/MonthInputType.cpp', >Index: Source/WebCore/WebCore.vcproj/WebCore.vcproj >=================================================================== >--- Source/WebCore/WebCore.vcproj/WebCore.vcproj (revision 139385) >+++ Source/WebCore/WebCore.vcproj/WebCore.vcproj (working copy) >@@ -64174,6 +64174,14 @@ > > > </File> > <File >+ RelativePath="..\html\MicroDataAttributeTokenList.cpp" >+ > >+ </File> >+ <File >+ RelativePath="..\html\MicroDataAttributeTokenList.h" >+ > >+ </File> >+ <File > RelativePath="..\html\MicroDataItemValue.cpp" > > > </File> >Index: Source/WebCore/dom/Node.cpp >=================================================================== >--- Source/WebCore/dom/Node.cpp (revision 139385) >+++ Source/WebCore/dom/Node.cpp (working copy) >@@ -2517,32 +2517,32 @@ bool Node::willRespondToTouchEvents() > #if ENABLE(MICRODATA) > DOMSettableTokenList* Node::itemProp() > { >- return ensureRareData()->itemProp(); >+ return ensureRareData()->itemProp(this); > } > > void Node::setItemProp(const String& value) > { >- ensureRareData()->setItemProp(value); >+ ensureRareData()->setItemProp(this, value); > } > > DOMSettableTokenList* Node::itemRef() > { >- return ensureRareData()->itemRef(); >+ return ensureRareData()->itemRef(this); > } > > void Node::setItemRef(const String& value) > { >- ensureRareData()->setItemRef(value); >+ ensureRareData()->setItemRef(this, value); > } > > DOMSettableTokenList* Node::itemType() > { >- return ensureRareData()->itemType(); >+ return ensureRareData()->itemType(this); > } > > void Node::setItemType(const String& value) > { >- ensureRareData()->setItemType(value); >+ ensureRareData()->setItemType(this, value); > } > > PassRefPtr<PropertyNodeList> Node::propertyNodeList(const String& name) >Index: Source/WebCore/dom/NodeRareData.h >=================================================================== >--- Source/WebCore/dom/NodeRareData.h (revision 139385) >+++ Source/WebCore/dom/NodeRareData.h (working copy) >@@ -24,6 +24,7 @@ > > #include "ChildNodeList.h" > #include "DOMSettableTokenList.h" >+#include "HTMLNames.h" > #include "LiveNodeList.h" > #include "MutationObserver.h" > #include "MutationObserverRegistration.h" >@@ -40,11 +41,14 @@ > > #if ENABLE(MICRODATA) > #include "HTMLPropertiesCollection.h" >+#include "MicroDataAttributeTokenList.h" > #include "MicroDataItemList.h" > #endif > > namespace WebCore { > >+using namespace HTMLNames; >+ > class LabelsNodeList; > class RadioNodeList; > class TreeScope; >@@ -238,9 +242,9 @@ class NodeRareData : public NodeRareData > > #if ENABLE(MICRODATA) > struct NodeMicroDataTokenLists { >- RefPtr<DOMSettableTokenList> m_itemProp; >- RefPtr<DOMSettableTokenList> m_itemRef; >- RefPtr<DOMSettableTokenList> m_itemType; >+ RefPtr<MicroDataAttributeTokenList> m_itemProp; >+ RefPtr<MicroDataAttributeTokenList> m_itemRef; >+ RefPtr<MicroDataAttributeTokenList> m_itemType; > > static PassOwnPtr<NodeMicroDataTokenLists> create() { return adoptPtr(new NodeMicroDataTokenLists); } > }; >@@ -319,52 +323,52 @@ public: > return m_microDataTokenLists.get(); > } > >- DOMSettableTokenList* itemProp() const >+ DOMSettableTokenList* itemProp(Node* node) const > { > if (!ensureMicroDataTokenLists()->m_itemProp) >- m_microDataTokenLists->m_itemProp = DOMSettableTokenList::create(); >+ m_microDataTokenLists->m_itemProp = MicroDataAttributeTokenList::create(toElement(node), itempropAttr); > > return m_microDataTokenLists->m_itemProp.get(); > } > >- void setItemProp(const String& value) >+ void setItemProp(Node* node, const String& value) > { > if (!ensureMicroDataTokenLists()->m_itemProp) >- m_microDataTokenLists->m_itemProp = DOMSettableTokenList::create(); >+ m_microDataTokenLists->m_itemProp = MicroDataAttributeTokenList::create(toElement(node), itempropAttr); > >- m_microDataTokenLists->m_itemProp->setValue(value); >+ m_microDataTokenLists->m_itemProp->resetValue(value); > } > >- DOMSettableTokenList* itemRef() const >+ DOMSettableTokenList* itemRef(Node* node) const > { > if (!ensureMicroDataTokenLists()->m_itemRef) >- m_microDataTokenLists->m_itemRef = DOMSettableTokenList::create(); >+ m_microDataTokenLists->m_itemRef = MicroDataAttributeTokenList::create(toElement(node), itemrefAttr); > > return m_microDataTokenLists->m_itemRef.get(); > } > >- void setItemRef(const String& value) >+ void setItemRef(Node* node, const String& value) > { > if (!ensureMicroDataTokenLists()->m_itemRef) >- m_microDataTokenLists->m_itemRef = DOMSettableTokenList::create(); >+ m_microDataTokenLists->m_itemRef = MicroDataAttributeTokenList::create(toElement(node), itemrefAttr); > >- m_microDataTokenLists->m_itemRef->setValue(value); >+ m_microDataTokenLists->m_itemRef->resetValue(value); > } > >- DOMSettableTokenList* itemType() const >+ DOMSettableTokenList* itemType(Node* node) const > { > if (!ensureMicroDataTokenLists()->m_itemType) >- m_microDataTokenLists->m_itemType = DOMSettableTokenList::create(); >+ m_microDataTokenLists->m_itemType = MicroDataAttributeTokenList::create(toElement(node), itemtypeAttr); > > return m_microDataTokenLists->m_itemType.get(); > } > >- void setItemType(const String& value) >+ void setItemType(Node* node, const String& value) > { > if (!ensureMicroDataTokenLists()->m_itemType) >- m_microDataTokenLists->m_itemType = DOMSettableTokenList::create(); >+ m_microDataTokenLists->m_itemType = MicroDataAttributeTokenList::create(toElement(node), itemtypeAttr); > >- m_microDataTokenLists->m_itemType->setValue(value); >+ m_microDataTokenLists->m_itemType->resetValue(value); > } > #endif > >Index: Source/WebCore/html/DOMSettableTokenList.h >=================================================================== >--- Source/WebCore/html/DOMSettableTokenList.h (revision 139385) >+++ Source/WebCore/html/DOMSettableTokenList.h (working copy) >@@ -58,9 +58,10 @@ public: > > const SpaceSplitString& tokens() const { return m_tokens; } > >-private: >+protected: > DOMSettableTokenList(); > >+private: > virtual void addInternal(const AtomicString&) OVERRIDE; > virtual bool containsInternal(const AtomicString&) const OVERRIDE; > virtual void removeInternal(const AtomicString&) OVERRIDE; >Index: Source/WebCore/html/MicroDataAttributeTokenList.cpp >=================================================================== >--- Source/WebCore/html/MicroDataAttributeTokenList.cpp (revision 0) >+++ Source/WebCore/html/MicroDataAttributeTokenList.cpp (working copy) >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (c) 2013 Motorola Mobility, Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without modification, >+ * are permitted provided that the following conditions are met: >+ * >+ * Redistributions of source code must retain the above copyright notice, >+ * this list of conditions and the following disclaimer. >+ * >+ * Redistributions in binary form must reproduce the above copyright notice, >+ * this list of conditions and the following disclaimer in the documentation and/or >+ * other materials provided with the distribution. >+ * >+ * Neither the name of Motorola Mobility, Inc. nor the names of its contributors may >+ * be used to endorse or promote products derived from this software without >+ * specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING >+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+ >+#if ENABLE(MICRODATA) >+ >+#include "MicroDataAttributeTokenList.h" >+ >+#include "Element.h" >+ >+namespace WebCore { >+ >+MicroDataAttributeTokenList::MicroDataAttributeTokenList(Element* element, const QualifiedName& attributeName) >+ : DOMSettableTokenList() >+ , m_element(element) >+ , m_attributeName(attributeName) >+{ >+} >+ >+void MicroDataAttributeTokenList::setValue(const AtomicString& value) >+{ >+ m_element->setAttribute(m_attributeName, value); >+} >+ >+void MicroDataAttributeTokenList::resetValue(const AtomicString& value) >+{ >+ DOMSettableTokenList::setValue(value); >+} >+ >+} // namespace WebCore >+ >+#endif // ENABLE(MICRODATA) >Index: Source/WebCore/html/MicroDataAttributeTokenList.h >=================================================================== >--- Source/WebCore/html/MicroDataAttributeTokenList.h (revision 0) >+++ Source/WebCore/html/MicroDataAttributeTokenList.h (working copy) >@@ -0,0 +1,70 @@ >+/* >+ * Copyright (c) 2013 Motorola Mobility, Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without modification, >+ * are permitted provided that the following conditions are met: >+ * >+ * Redistributions of source code must retain the above copyright notice, >+ * this list of conditions and the following disclaimer. >+ * >+ * Redistributions in binary form must reproduce the above copyright notice, >+ * this list of conditions and the following disclaimer in the documentation and/or >+ * other materials provided with the distribution. >+ * >+ * Neither the name of Motorola Mobility, Inc. nor the names of its contributors may >+ * be used to endorse or promote products derived from this software without >+ * specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING >+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef MicroDataAttributeTokenList_h >+#define MicroDataAttributeTokenList_h >+ >+#if ENABLE(MICRODATA) >+ >+#include "DOMSettableTokenList.h" >+#include "QualifiedName.h" >+ >+namespace WebCore { >+ >+class Element; >+ >+typedef int ExceptionCode; >+ >+class MicroDataAttributeTokenList : public DOMSettableTokenList { >+public: >+ static PassRefPtr<MicroDataAttributeTokenList> create(Element* element, const QualifiedName& attributeName) >+ { >+ return adoptRef(new MicroDataAttributeTokenList(element, attributeName)); >+ } >+ >+ virtual Element* element() OVERRIDE { return m_element; } >+ >+ void resetValue(const AtomicString& value); >+ >+private: >+ MicroDataAttributeTokenList(Element*, const QualifiedName&); >+ >+ virtual void setValue(const AtomicString&) OVERRIDE; >+ >+ Element* m_element; >+ QualifiedName m_attributeName; >+ >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(MICRODATA) >+ >+#endif // MicroDataAttributeTokenList_h >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 139385) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,20 @@ >+2013-01-10 Arko Saha <arko@motorola.com> >+ >+ Microdata: itemtype attribute must update correctly on adding or removing tokens >+ https://bugs.webkit.org/show_bug.cgi?id=106616 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added tests to ensure that itemtype, itemprop, itemref attributes must update >+ correctly when tokens have been added or removed. >+ >+ * fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens-expected.txt: Added. >+ * fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens.html: Added. >+ * fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens-expected.txt: Added. >+ * fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens.html: Added. >+ * fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens-expected.txt: Added. >+ * fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens.html: Added. >+ > 2013-01-10 James Robinson <jamesr@chromium.org> > > [chromium] Store scrollable layer's contents size for coordinated scrollable layers >Index: LayoutTests/fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens-expected.txt >=================================================================== >--- LayoutTests/fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens-expected.txt (revision 0) >+++ LayoutTests/fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens-expected.txt (working copy) >@@ -0,0 +1,23 @@ >+This tests that itemtype, itemprop, itemref attributes must update correctly when tokens have been added or removed. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+itemtype attribute test. >+PASS element.getAttribute('itemtype') is 'foo FOO' >+PASS element.getAttribute('itemtype') is 'FOO' >+PASS element.getAttribute('itemtype') is '' >+ >+itemprop attribute test. >+PASS element.getAttribute('itemprop') is 'foo FOO' >+PASS element.getAttribute('itemprop') is 'FOO' >+PASS element.getAttribute('itemprop') is '' >+ >+itemref attribute test. >+PASS element.getAttribute('itemref') is 'foo FOO' >+PASS element.getAttribute('itemref') is 'FOO' >+PASS element.getAttribute('itemref') is '' >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >Index: LayoutTests/fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens.html >=================================================================== >--- LayoutTests/fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens.html (revision 0) >+++ LayoutTests/fast/dom/MicroData/microdata-domtokenlist-attribute-add-remove-tokens.html (working copy) >@@ -0,0 +1,43 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../js/resources/js-test-pre.js"></script> >+</head> >+<body> >+<div id="mydiv"></div> >+<script> >+description("This tests that itemtype, itemprop, itemref attributes must update correctly when tokens have been added or removed."); >+var element = document.getElementById("mydiv"); >+ >+debug("itemtype attribute test."); >+element.itemType.add('foo'); >+element.itemType.add('FOO'); >+shouldBe("element.getAttribute('itemtype')", "'foo FOO'"); >+element.itemType.remove('foo'); >+shouldBe("element.getAttribute('itemtype')", "'FOO'"); >+element.itemType.remove('FOO'); >+shouldBe("element.getAttribute('itemtype')", "''"); >+ >+debug(""); >+debug("itemprop attribute test."); >+element.itemProp.add('foo'); >+element.itemProp.add('FOO'); >+shouldBe("element.getAttribute('itemprop')", "'foo FOO'"); >+element.itemProp.remove('foo'); >+shouldBe("element.getAttribute('itemprop')", "'FOO'"); >+element.itemProp.remove('FOO'); >+shouldBe("element.getAttribute('itemprop')", "''"); >+ >+debug(""); >+debug("itemref attribute test."); >+element.itemRef.add('foo'); >+element.itemRef.add('FOO'); >+shouldBe("element.getAttribute('itemref')", "'foo FOO'"); >+element.itemRef.remove('foo'); >+shouldBe("element.getAttribute('itemref')", "'FOO'"); >+element.itemRef.remove('FOO'); >+shouldBe("element.getAttribute('itemref')", "''"); >+</script> >+<script src="../../js/resources/js-test-post.js"></script> >+</body> >+</html> >Index: LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens-expected.txt >=================================================================== >--- LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens-expected.txt (revision 0) >+++ LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens-expected.txt (working copy) >@@ -0,0 +1,26 @@ >+Test to ensure that adding or removing itemprop tokens must update its PropertyNodeList. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Created element of type: div >+Set attribute: itemscope, value: itemscope >+PASS PNLfoo.length is 1 >+PASS PNLbar.length is 0 >+PASS PNLfoo[0] is item.firstChild >+PASS PNLfoo.length is 1 >+PASS PNLbar.length is 1 >+PASS PNLfoo[0] is item.firstChild >+PASS PNLbar[0] is item.lastChild >+PASS PNLfoo.length is 2 >+PASS PNLbar.length is 1 >+PASS PNLfoo[0] is item.firstChild >+PASS PNLfoo[1] is item.lastChild >+PASS PNLbar[0] is item.lastChild >+PASS PNLfoo.length is 1 >+PASS PNLbar.length is 0 >+PASS PNLfoo[0] is item.firstChild >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >Index: LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens.html >=================================================================== >--- LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens.html (revision 0) >+++ LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemprop-tokens.html (working copy) >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../js/resources/js-test-pre.js"></script> >+<script src="resources/microdata-common.js"></script> >+</head> >+<body> >+<script> >+description("Test to ensure that adding or removing itemprop tokens must update its PropertyNodeList."); >+var item = createElement('div', {itemscope: 'itemscope'}, '<div itemprop="foo"></div><div></div>'); >+var PNLfoo = item.properties.namedItem('foo'); >+PNLbar = item.properties.namedItem('bar'); >+ >+shouldBe("PNLfoo.length", "1"); >+shouldBe("PNLbar.length", "0"); >+shouldBe("PNLfoo[0]", "item.firstChild"); >+ >+item.lastChild.itemProp.toggle('bar'); >+shouldBe("PNLfoo.length", "1"); >+shouldBe("PNLbar.length", "1"); >+shouldBe("PNLfoo[0]", "item.firstChild"); >+shouldBe("PNLbar[0]", "item.lastChild"); >+ >+item.lastChild.itemProp.add('foo'); >+shouldBe("PNLfoo.length", "2"); >+shouldBe("PNLbar.length", "1"); >+shouldBe("PNLfoo[0]", "item.firstChild"); >+shouldBe("PNLfoo[1]", "item.lastChild"); >+shouldBe("PNLbar[0]", "item.lastChild"); >+ >+item.lastChild.removeAttribute('itemprop'); >+shouldBe("PNLfoo.length", "1"); >+shouldBe("PNLbar.length", "0"); >+shouldBe("PNLfoo[0]", "item.firstChild"); >+</script> >+<script src="../../js/resources/js-test-post.js"></script> >+</body> >+</html> >Index: LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens-expected.txt >=================================================================== >--- LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens-expected.txt (revision 0) >+++ LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens-expected.txt (working copy) >@@ -0,0 +1,20 @@ >+Test to ensure that adding or removing itemref tokens must update its PropertyNodeList. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Created element of type: div >+PASS PNL.length is 0 >+PASS PNL.length is 1 >+PASS PNL[0] is parent.firstChild >+PASS PNL.length is 0 >+PASS !PNL[0] is true >+PASS length0 is 0 >+PASS length1 is 1 >+PASS foo0 is parent.firstChild >+PASS length2 is 0 >+PASS !foo1 is true >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >Index: LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens.html >=================================================================== >--- LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens.html (revision 0) >+++ LayoutTests/fast/dom/MicroData/propertynodelist-add-remove-itemref-tokens.html (working copy) >@@ -0,0 +1,39 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../js/resources/js-test-pre.js"></script> >+<script src="resources/microdata-common.js"></script> >+</head> >+<body> >+<script> >+description("Test to ensure that adding or removing itemref tokens must update its PropertyNodeList."); >+var parent = createElement('div', {}, '<div id="id1" itemprop="foo"></div><div itemscope></div>'); >+var testElement = parent.childNodes[1]; >+var PNL = testElement.properties.namedItem('foo'); >+ >+shouldBe("PNL.length", "0"); >+testElement.itemRef.add('id1'); >+shouldBe("PNL.length", "1"); >+shouldBe("PNL[0]", "parent.firstChild"); >+testElement.itemRef.remove('id1'); >+shouldBe("PNL.length", "0"); >+shouldBeTrue("!PNL[0]"); >+ >+document.body.appendChild(parent); >+var length0 = PNL.length; >+testElement.itemRef.toggle('id1'); >+var length1 = PNL.length; >+var foo0 = PNL[0]; >+testElement.removeAttribute('itemref'); >+var length2 = PNL.length; >+var foo1 = PNL[0]; >+document.body.removeChild(parent); >+shouldBe("length0", "0"); >+shouldBe("length1", "1"); >+shouldBe("foo0", "parent.firstChild"); >+shouldBe("length2", "0"); >+shouldBeTrue("!foo1"); >+</script> >+<script src="../../js/resources/js-test-post.js"></script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 106616
:
182226
|
184341
|
184373
|
184544