Skip to content
  • morrita@google.com's avatar
    Custom Elements: should support non-HTML namespaces. · d2d3b7da
    morrita@google.com authored
    https://bugs.webkit.org/show_bug.cgi?id=111693
    
    Reviewed by Dimitri Glazkov.
    
    Source/WebCore:
    
    Some existing code assumes that the element extends HTMLElements.
    This change allow it to extend from Element. Note that the
    namespace URI of a custom element is determined by given element
    prototype: An element will have XHTML namespace if its prototype
    chain includes HTMLElements, SVGElement leads SVG namespace and
    null otherwise, respectively.
    
    Test: fast/dom/custom/document-register-namespace.html
    
    * bindings/v8/CustomElementHelpers.cpp:
    (WebCore::hasValidPrototypeChainFor): Factored out from isValidPrototypeParameter()
    (WebCore::CustomElementHelpers::isValidPrototypeParameter): Extend to support non HTMLElement prototype
    (WebCore::CustomElementHelpers::findLocalName): Support non-HTML element names.
    * bindings/v8/CustomElementHelpers.h:
    (CustomElementHelpers):
    * dom/CustomElementConstructor.cpp:
    (WebCore::CustomElementConstructor::createElementInternal):
    * dom/CustomElementRegistry.cpp:
    (WebCore::CustomElementRegistry::registerElement): No longer hard-codes namespace and picks one based on the prototype value.
    * dom/CustomElementRegistry.h:
    (CustomElementRegistry):
    
    LayoutTests:
    
    * fast/dom/custom/document-register-namespace-expected.txt: Added.
    * fast/dom/custom/document-register-namespace.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147113 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    d2d3b7da