Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

fix form.elements -- this is used by NodeBind getAssociatedRadioButtons #462

Merged
merged 1 commit into from
Jun 27, 2014

Conversation

jmesserly
Copy link
Contributor

form.elements should return an HTMLCollection.

this code in NodeBind.js

     return filter(element.form.elements, function(el) {
        return el != element &&
            el.tagName == 'INPUT' &&
            el.type == 'radio' &&
            el.name == element.name;
      });

...uses form.elements, which was returning unwrapped nodes under SD polyfill. This later causes an error because Node.bind stores bindings_ on the wrapper, and when it doesn't find the data it stored, blows up with a TypeError.

Caught this by running NodeBind tests with platform.js (normally they don't run with SD polyfill -- maybe they should?)

@jmesserly
Copy link
Contributor Author

Hey, @arv do you mind taking a look?

I patterned it after similar wrappers like HTMLTableRowElement. All tests pass after this change.

var registerWrapper = scope.registerWrapper;
var wrapHTMLCollection = scope.wrapHTMLCollection;
var unwrap = scope.unwrap;
var wrap = scope.wrap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like you are using wrap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. fixed!

@arv
Copy link
Contributor

arv commented Jun 27, 2014

LGTM

HTMLFormControlsCollection is one of the worst abominations of the DOM APIs. It has named interceptors too and sometimes these return an element and sometime another collection. Hopefully we do not have to ever implement that.

jmesserly pushed a commit that referenced this pull request Jun 27, 2014
fix form.elements -- this is used by NodeBind getAssociatedRadioButtons
@jmesserly jmesserly merged commit b2c730a into master Jun 27, 2014
@jmesserly jmesserly deleted the fix_form_elements branch June 27, 2014 21:06
svn2github pushed a commit to svn2github/dart-lang that referenced this pull request Jul 15, 2014
… with Dart binding paths for things that are not JSON serializable.

Two big things this enables:
* elements themselves can be data bound
* anything jsify can handle, including Dart functions. This means as we get @export and such, it will be possible to bind those Dart types directly into JS elements. With that we can make things like <core-style> much nicer to use.

This also removes ported code from https://github.com/Polymer/NodeBind except for interfaces, since we don't need it anymore.

Added a Polymer test to verify it works for the typical end-to-end case. This uncovered the "deliver" method that needs to be there on Bindable.

Finally one Node.bind test depends on googlearchive/ShadowDOM#462, which fixes an issue where SD polyfill doesn't wrap an API used by Node.bind. Apparently no one has ever hit this on the JS side (the Dart port was immune, because our treatment of HTMLCollection is better).

[email protected]

Review URL: https://codereview.chromium.org//355133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@38051 260f80e4-7a28-3924-810f-c04153c831b5
jmesserly pushed a commit to dart-archive/polymer-dart that referenced this pull request Dec 20, 2014
… with Dart binding paths for things that are not JSON serializable.

Two big things this enables:
* elements themselves can be data bound
* anything jsify can handle, including Dart functions. This means as we get @export and such, it will be possible to bind those Dart types directly into JS elements. With that we can make things like <core-style> much nicer to use.

This also removes ported code from https://github.com/Polymer/NodeBind except for interfaces, since we don't need it anymore.

Added a Polymer test to verify it works for the typical end-to-end case. This uncovered the "deliver" method that needs to be there on Bindable.

Finally one Node.bind test depends on googlearchive/ShadowDOM#462, which fixes an issue where SD polyfill doesn't wrap an API used by Node.bind. Apparently no one has ever hit this on the JS side (the Dart port was immune, because our treatment of HTMLCollection is better).

[email protected]

Review URL: https://codereview.chromium.org//355133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/polymer@38051 260f80e4-7a28-3924-810f-c04153c831b5
jmesserly pushed a commit to dart-archive/observe that referenced this pull request Dec 20, 2014
… with Dart binding paths for things that are not JSON serializable.

Two big things this enables:
* elements themselves can be data bound
* anything jsify can handle, including Dart functions. This means as we get @export and such, it will be possible to bind those Dart types directly into JS elements. With that we can make things like <core-style> much nicer to use.

This also removes ported code from https://github.com/Polymer/NodeBind except for interfaces, since we don't need it anymore.

Added a Polymer test to verify it works for the typical end-to-end case. This uncovered the "deliver" method that needs to be there on Bindable.

Finally one Node.bind test depends on googlearchive/ShadowDOM#462, which fixes an issue where SD polyfill doesn't wrap an API used by Node.bind. Apparently no one has ever hit this on the JS side (the Dart port was immune, because our treatment of HTMLCollection is better).

[email protected]

Review URL: https://codereview.chromium.org//355133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/observe@38051 260f80e4-7a28-3924-810f-c04153c831b5
jmesserly pushed a commit to dart-archive/polymer-expressions that referenced this pull request Dec 20, 2014
… with Dart binding paths for things that are not JSON serializable.

Two big things this enables:
* elements themselves can be data bound
* anything jsify can handle, including Dart functions. This means as we get @export and such, it will be possible to bind those Dart types directly into JS elements. With that we can make things like <core-style> much nicer to use.

This also removes ported code from https://github.com/Polymer/NodeBind except for interfaces, since we don't need it anymore.

Added a Polymer test to verify it works for the typical end-to-end case. This uncovered the "deliver" method that needs to be there on Bindable.

Finally one Node.bind test depends on googlearchive/ShadowDOM#462, which fixes an issue where SD polyfill doesn't wrap an API used by Node.bind. Apparently no one has ever hit this on the JS side (the Dart port was immune, because our treatment of HTMLCollection is better).

[email protected]

Review URL: https://codereview.chromium.org//355133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/polymer_expressions@38051 260f80e4-7a28-3924-810f-c04153c831b5
jmesserly pushed a commit to dart-archive/template-binding that referenced this pull request Dec 20, 2014
… with Dart binding paths for things that are not JSON serializable.

Two big things this enables:
* elements themselves can be data bound
* anything jsify can handle, including Dart functions. This means as we get @export and such, it will be possible to bind those Dart types directly into JS elements. With that we can make things like <core-style> much nicer to use.

This also removes ported code from https://github.com/Polymer/NodeBind except for interfaces, since we don't need it anymore.

Added a Polymer test to verify it works for the typical end-to-end case. This uncovered the "deliver" method that needs to be there on Bindable.

Finally one Node.bind test depends on googlearchive/ShadowDOM#462, which fixes an issue where SD polyfill doesn't wrap an API used by Node.bind. Apparently no one has ever hit this on the JS side (the Dart port was immune, because our treatment of HTMLCollection is better).

[email protected]

Review URL: https://codereview.chromium.org//355133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/template_binding@38051 260f80e4-7a28-3924-810f-c04153c831b5
jmesserly pushed a commit to dart-archive/web-components that referenced this pull request Dec 20, 2014
… with Dart binding paths for things that are not JSON serializable.

Two big things this enables:
* elements themselves can be data bound
* anything jsify can handle, including Dart functions. This means as we get @export and such, it will be possible to bind those Dart types directly into JS elements. With that we can make things like <core-style> much nicer to use.

This also removes ported code from https://github.com/Polymer/NodeBind except for interfaces, since we don't need it anymore.

Added a Polymer test to verify it works for the typical end-to-end case. This uncovered the "deliver" method that needs to be there on Bindable.

Finally one Node.bind test depends on googlearchive/ShadowDOM#462, which fixes an issue where SD polyfill doesn't wrap an API used by Node.bind. Apparently no one has ever hit this on the JS side (the Dart port was immune, because our treatment of HTMLCollection is better).

[email protected]

Review URL: https://codereview.chromium.org//355133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/web_components@38051 260f80e4-7a28-3924-810f-c04153c831b5
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants