_FormValueWidget.js.uncompressed.js 2.0 KB

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