⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259651 in webkit


Ignore:
Timestamp:
Apr 7, 2020, 11:40:07 AM (6 years ago)
Author:
Chris Dumez
Message:

documentFragment.getElementById() should not work for empty-string IDs
https://bugs.webkit.org/show_bug.cgi?id=210111

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

Import test coverage from upstream WPT.

  • web-platform-tests/dom/nodes/DocumentFragment-getElementById-expected.txt: Added.
  • web-platform-tests/dom/nodes/DocumentFragment-getElementById.html: Added.

Source/WebCore:

Make sure that getElementById() returns null when given an empty string ID:

Test: imported/w3c/web-platform-tests/dom/nodes/DocumentFragment-getElementById.html

  • dom/DocumentFragment.cpp:

(WebCore::DocumentFragment::getElementById const):

  • dom/TreeScope.cpp:

(WebCore::TreeScope::getElementById const):

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r259577 r259651  
     12020-04-07  Chris Dumez  <cdumez@apple.com>
     2
     3        documentFragment.getElementById() should not work for empty-string IDs
     4        https://bugs.webkit.org/show_bug.cgi?id=210111
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Import test coverage from upstream WPT.
     9
     10        * web-platform-tests/dom/nodes/DocumentFragment-getElementById-expected.txt: Added.
     11        * web-platform-tests/dom/nodes/DocumentFragment-getElementById.html: Added.
     12
    1132020-04-06  Antoine Quint  <graouts@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r259650 r259651  
     12020-04-07  Chris Dumez  <cdumez@apple.com>
     2
     3        documentFragment.getElementById() should not work for empty-string IDs
     4        https://bugs.webkit.org/show_bug.cgi?id=210111
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Make sure that getElementById() returns null when given an empty string ID:
     9        - https://dom.spec.whatwg.org/#concept-id
     10
     11        Test: imported/w3c/web-platform-tests/dom/nodes/DocumentFragment-getElementById.html
     12
     13        * dom/DocumentFragment.cpp:
     14        (WebCore::DocumentFragment::getElementById const):
     15        * dom/TreeScope.cpp:
     16        (WebCore::TreeScope::getElementById const):
     17
    1182020-04-07  Timothy Hatcher  <timothy@apple.com>
    219
  • trunk/Source/WebCore/dom/DocumentFragment.cpp

    r257188 r259651  
    9696Element* DocumentFragment::getElementById(const AtomString& id) const
    9797{
    98     if (id.isNull())
     98    if (id.isEmpty())
    9999        return nullptr;
    100100
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r257592 r259651  
    101101Element* TreeScope::getElementById(const AtomString& elementId) const
    102102{
    103     if (elementId.isNull())
     103    if (elementId.isEmpty())
    104104        return nullptr;
    105105    if (!m_elementsById)
Note: See TracChangeset for help on using the changeset viewer.