This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix form.elements -- this is used by NodeBind getAssociatedRadioButtons
- Loading branch information
John Messerly
committed
Jun 27, 2014
1 parent
527721a
commit a6d36f8
Showing
5 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2014 The Polymer Authors. All rights reserved. | ||
* Use of this source code is governed by a BSD-style | ||
* license that can be found in the LICENSE file. | ||
*/ | ||
|
||
(function(scope) { | ||
'use strict'; | ||
|
||
var HTMLElement = scope.wrappers.HTMLElement; | ||
var mixin = scope.mixin; | ||
var registerWrapper = scope.registerWrapper; | ||
var wrapHTMLCollection = scope.wrapHTMLCollection; | ||
var unwrap = scope.unwrap; | ||
|
||
var OriginalHTMLFormElement = window.HTMLFormElement; | ||
|
||
function HTMLFormElement(node) { | ||
HTMLElement.call(this, node); | ||
} | ||
HTMLFormElement.prototype = Object.create(HTMLElement.prototype); | ||
mixin(HTMLFormElement.prototype, { | ||
get elements() { | ||
// Note: technically this should be an HTMLFormControlsCollection, but | ||
// that inherits from HTMLCollection, so should be good enough. Spec: | ||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlformcontrolscollection | ||
return wrapHTMLCollection(unwrap(this).elements); | ||
} | ||
}); | ||
|
||
registerWrapper(OriginalHTMLFormElement, HTMLFormElement, | ||
document.createElement('form')); | ||
|
||
scope.wrappers.HTMLFormElement = HTMLFormElement; | ||
})(window.ShadowDOMPolyfill); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright 2014 The Polymer Authors. All rights reserved. | ||
* Use of this source code is governed by a BSD-style | ||
* license that can be found in the LICENSE file. | ||
*/ | ||
|
||
suite('HTMLFormElement', function() { | ||
|
||
test('elements', function() { | ||
var form = document.createElement('form'); | ||
var input = document.createElement('input'); | ||
form.appendChild(input); | ||
assert.instanceOf(form.elements, HTMLCollection); | ||
assert.equal(form.elements.length, 1); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters