| Page 1 of 1 | [ 10 posts ] |
JB Malatrasi
|
Hi,
Whenever I apply an Event delegate on inputs change, it never fires on IE. Ex : Code: Y.delegate('change',function(){ alert("change ok!"); },document.body,'.inputDelegate'); <div><input type="text" class="inputDelegate" /></div> You can see an exemple online : http://www.jumbay.info/yui/delegate/ But others events like: click, mousemove,... are working. Is there a way to solve that (without apply an listener on each elements)? Thanks. |
|
I am not sure YUI3 can improve that much on what the DOM does not provide:
http://www.quirksmode.org/dom/events/change.html Bookmark that site, if something doesn't work, it is the place to go and check. |
|
I workarounded that problem using "beforeactivate"/"focusout" events and custom attributes:
Code: Y.delegate("beforeactivate", function (event) { var target = event.currentTarget; target.setAttribute("_original_value_", target.get("value")); }, document.body, ".inputDelegate", this); Y.delegate("focusout", function (event) { var target = event.currentTarget; if (target.get("value") !== target.getAttribute("_original_value_")) { this.commentChanged(event); // "this.commentChanged" is a regular event handler } }, document.body, ".inputDelegate", this); Edit: Use this workaround only if "change" delegation isn't supported: Code: // see http://www.neeraj.name/blog/articles/893 var eventSupported = function (eventName) { var el = document.createElement("div"); eventName = "on" + eventName; var isSupported = (eventName in el); if (!isSupported) { el.setAttribute(eventName, "return;"); isSupported = typeof el[eventName] === "function"; } el = null; return isSupported; }; if (!eventSupported("change") && eventSupported("beforeactivate") && eventSupported("focusout")) { // INSERT WORKAROUND HERE } |
JB Malatrasi
|
@Satyam : I've already check this website, and it's wrote that change event is working in IE.
@Fiouz : The event should be supported. I apply it on the input, not on the div. So change event on an input text is supported. Anyway if I do that: Code: <input id="classic" type="text" /> Y.on('change',function(){ alert("Classic event fire on change"); },'#classic') The event will fire on IE. By the way, I tested with the latest jQuery version, and it's working very well. Check my sample on line, I've update it. |
|
I’m working on a Gallery module to allow bubbling of form events: submit, change, reset. They are pretty tricky in general with the change event being the hardest
Depending on which route I end up taking, the delegate method may/may-not work. Luke Smith wrote the event-synthetic module which I was thinking of using, but that doesn't have support of the delegate method currently. |
JB Malatrasi
|
Ok, I will watch your gallery module
But the fact that this event is not supported in IE, it's a kind of bug. |
|
Has anything been figured out for this problem?
It does not appear that the gallery object has gone anywhere. |
|
http://yuilibrary.com/projects/yui3/ticket/2528683
http://yuilibrary.com/projects/yui3/ticket/2531106 http://yuilibrary.com/projects/yui3/ticket/2526038 Looks like I have some duplicates to mark. But this is on the roadmap for 3.5.0. |
|
Hello,
We implemented this feature in AlloyUI library. The code is here. If you guys are interested, we can contribute it to YUI3. Please let me know. Iliyan |
|
Just a quick update, using http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js, delegate("change",function) works in IE 8 and 9 (didn't test below 8)
---- EDIT ---- Well, now i am using 3.7.2 and it appears it is not working in IE 8... 9 is still ok. |
| Page 1 of 1 | [ 10 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group