document.getItems() must return all top-level microdata items in the document when no tokens specified in the argument. spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#dom-document-getitems sample test: <div itemscope itemtype="http://example.com/bar"></div> <div itemscope></div> <script type ="text/javascript"> assert_equals( document.getItems('').length, 2, 'empty string' ); </script> Expected: document.getItems('').length must return 2 Actual: Fail- empty string expected 2 but got 1
Created attachment 156272 [details] Patch
Comment on attachment 156272 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=156272&action=review > Source/WebCore/dom/MicroDataItemList.cpp:68 > + if (m_originalTypeNames == undefinedItemType() || !m_typeNames.size()) Should we change undefinedItemType() to be ''?
(In reply to comment #2) > (From update of attachment 156272 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=156272&action=review > > > Source/WebCore/dom/MicroDataItemList.cpp:68 > > + if (m_originalTypeNames == undefinedItemType() || !m_typeNames.size()) > > Should we change undefinedItemType() to be ''? It is possible to call getItems() with empty string '' and string with spaces ' ' (no tokens). We can not handle these string with spaces case if we change undefinedItemType() to be ''. I think checking size of the token i.e, !m_typeNames.size() is appropriate here as m_typeNames is a SpaceSplitString and its size will be zero in all cases like "", " ", " ",etc.
(In reply to comment #3) > (In reply to comment #2) > > (From update of attachment 156272 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=156272&action=review > > > > > Source/WebCore/dom/MicroDataItemList.cpp:68 > > > + if (m_originalTypeNames == undefinedItemType() || !m_typeNames.size()) > > > > Should we change undefinedItemType() to be ''? > > It is possible to call getItems() with empty string '' and string with spaces ' ' (no tokens). We can not handle these string with spaces case if we change undefinedItemType() to be ''. > I think checking size of the token i.e, !m_typeNames.size() is appropriate here as m_typeNames is a SpaceSplitString and its size will be zero in all cases like "", " ", " ",etc. What I meant is that use '' when we're creating MicroDataItemList. We can just pass in '' so that the SpaceSplitString has size 0.
Landed in: <http://trac.webkit.org/changeset/124750>