1 | define([ |
---|
2 | "dojo/_base/declare", // declare |
---|
3 | "dojo/sniff", // has("ie") |
---|
4 | "./_FormWidget", |
---|
5 | "./_FormValueMixin" |
---|
6 | ], function(declare, has, _FormWidget, _FormValueMixin){ |
---|
7 | |
---|
8 | // module: |
---|
9 | // dijit/form/_FormValueWidget |
---|
10 | |
---|
11 | return declare("dijit.form._FormValueWidget", [_FormWidget, _FormValueMixin], { |
---|
12 | // summary: |
---|
13 | // Base class for widgets corresponding to native HTML elements such as `<input>` or `<select>` |
---|
14 | // that have user changeable values. |
---|
15 | // description: |
---|
16 | // Each _FormValueWidget represents a single input value, and has a (possibly hidden) `<input>` element, |
---|
17 | // to which it serializes it's input value, so that form submission (either normal submission or via FormBind?) |
---|
18 | // works as expected. |
---|
19 | |
---|
20 | // Don't attempt to mixin the 'type', 'name' attributes here programatically -- they must be declared |
---|
21 | // directly in the template as read by the parser in order to function. IE is known to specifically |
---|
22 | // require the 'name' attribute at element creation time. See #8484, #8660. |
---|
23 | |
---|
24 | _layoutHackIE7: function(){ |
---|
25 | // summary: |
---|
26 | // Work around table sizing bugs on IE7 by forcing redraw |
---|
27 | |
---|
28 | if(has("ie") == 7){ // fix IE7 layout bug when the widget is scrolled out of sight |
---|
29 | var domNode = this.domNode; |
---|
30 | var parent = domNode.parentNode; |
---|
31 | var pingNode = domNode.firstChild || domNode; // target node most unlikely to have a custom filter |
---|
32 | var origFilter = pingNode.style.filter; // save custom filter, most likely nothing |
---|
33 | var _this = this; |
---|
34 | while(parent && parent.clientHeight == 0){ // search for parents that haven't rendered yet |
---|
35 | (function ping(){ |
---|
36 | var disconnectHandle = _this.connect(parent, "onscroll", |
---|
37 | function(){ |
---|
38 | _this.disconnect(disconnectHandle); // only call once |
---|
39 | pingNode.style.filter = (new Date()).getMilliseconds(); // set to anything that's unique |
---|
40 | _this.defer(function(){ |
---|
41 | pingNode.style.filter = origFilter; |
---|
42 | }); // restore custom filter, if any |
---|
43 | } |
---|
44 | ); |
---|
45 | })(); |
---|
46 | parent = parent.parentNode; |
---|
47 | } |
---|
48 | } |
---|
49 | } |
---|
50 | }); |
---|
51 | }); |
---|