Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

form.elements not according to w3 spec on safari #217

Closed
@janvandenberg

Description

@janvandenberg

I have a third-party library which I use that does a IE 6/7 bug detection in my web application:

function testForNamePropertyBug(){
    var form = document.body.appendChild(document.createElement("form")), input = form.appendChild(document.createElement("input"));
    input.name = IFRAME_PREFIX + "TEST" + channelId; // append channelId in order to avoid caching issues
    HAS_NAME_PROPERTY_BUG = input !== form.elements[input.name];
    document.body.removeChild(form);
}

The problem is the line where form.elements[input.name] does not return a nodeList like the spec dictates (https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/elements) but a simple array. So this test provides a false positive. on Safari 8.0.3 with OSX 10.10.2.

Webcomponents.js is the reason why this happens. It polyfills the elements method and returns the wrong object:

    mixin(HTMLFormElement.prototype, {
      get elements() {
        return wrapHTMLCollection(unwrap(this).elements);
      }
    });

Could it be possible to fix this in future releases of webcomponents.js?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions