This repository was archived by the owner on Mar 13, 2018. It is now read-only.
File tree 5 files changed +55
-0
lines changed
5 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 19
19
" src/wrappers/HTMLElement.js" ,
20
20
" src/wrappers/HTMLCanvasElement.js" ,
21
21
" src/wrappers/HTMLContentElement.js" ,
22
+ " src/wrappers/HTMLFormElement.js" ,
22
23
" src/wrappers/HTMLImageElement.js" ,
23
24
" src/wrappers/HTMLShadowElement.js" ,
24
25
" src/wrappers/HTMLTemplateElement.js" ,
Original file line number Diff line number Diff line change 35
35
'src/wrappers/HTMLElement.js' ,
36
36
'src/wrappers/HTMLCanvasElement.js' ,
37
37
'src/wrappers/HTMLContentElement.js' ,
38
+ 'src/wrappers/HTMLFormElement.js' ,
38
39
'src/wrappers/HTMLImageElement.js' ,
39
40
'src/wrappers/HTMLShadowElement.js' ,
40
41
'src/wrappers/HTMLTemplateElement.js' ,
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2014 The Polymer Authors. All rights reserved.
3
+ * Use of this source code is governed by a BSD-style
4
+ * license that can be found in the LICENSE file.
5
+ */
6
+
7
+ ( function ( scope ) {
8
+ 'use strict' ;
9
+
10
+ var HTMLElement = scope . wrappers . HTMLElement ;
11
+ var mixin = scope . mixin ;
12
+ var registerWrapper = scope . registerWrapper ;
13
+ var wrapHTMLCollection = scope . wrapHTMLCollection ;
14
+ var unwrap = scope . unwrap ;
15
+
16
+ var OriginalHTMLFormElement = window . HTMLFormElement ;
17
+
18
+ function HTMLFormElement ( node ) {
19
+ HTMLElement . call ( this , node ) ;
20
+ }
21
+ HTMLFormElement . prototype = Object . create ( HTMLElement . prototype ) ;
22
+ mixin ( HTMLFormElement . prototype , {
23
+ get elements ( ) {
24
+ // Note: technically this should be an HTMLFormControlsCollection, but
25
+ // that inherits from HTMLCollection, so should be good enough. Spec:
26
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlformcontrolscollection
27
+ return wrapHTMLCollection ( unwrap ( this ) . elements ) ;
28
+ }
29
+ } ) ;
30
+
31
+ registerWrapper ( OriginalHTMLFormElement , HTMLFormElement ,
32
+ document . createElement ( 'form' ) ) ;
33
+
34
+ scope . wrappers . HTMLFormElement = HTMLFormElement ;
35
+ } ) ( window . ShadowDOMPolyfill ) ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2014 The Polymer Authors. All rights reserved.
3
+ * Use of this source code is governed by a BSD-style
4
+ * license that can be found in the LICENSE file.
5
+ */
6
+
7
+ suite ( 'HTMLFormElement' , function ( ) {
8
+
9
+ test ( 'elements' , function ( ) {
10
+ var form = document . createElement ( 'form' ) ;
11
+ var input = document . createElement ( 'input' ) ;
12
+ form . appendChild ( input ) ;
13
+ assert . instanceOf ( form . elements , HTMLCollection ) ;
14
+ assert . equal ( form . elements . length , 1 ) ;
15
+ } ) ;
16
+
17
+ } ) ;
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ var modules = [
85
85
'HTMLContentElement.js' ,
86
86
'HTMLElement.js' ,
87
87
'HTMLFieldSetElement.js' ,
88
+ 'HTMLFormElement.js' ,
88
89
'HTMLHeadElement.js' ,
89
90
'HTMLHtmlElement.js' ,
90
91
'HTMLImageElement.js' ,
You can’t perform that action at this time.
0 commit comments