[ 6 posts ]

Josh Lizarraga

YUI Contributor

  • Offline
  • Profile

Focus/blur delegation in IE?

Post Posted: Fri Aug 07, 2009 5:03 pm
+0-
Hi all,

I must be doing something wrong, because this extremely basic example works in in Firefox 3.0, Safari 3, Chrome 2, and Opera 9.6, but not in IE6 or IE7:

Code:
<div id="demo">
    <input type="text" />
</div>

<script src="http://yui.yahooapis.com/3.0.0b1/build/yui/yui-min.js" type="text/javascript"></script>
<script type="text/javascript">

YUI().use('event', function(Y){
   
   Y.on('blur', function(){alert('blur')}, '#demo');
   
});

</script>


Any help is greatly appreciated!

Adam Moore

YUI Contributor

  • Username: adam
  • Joined: Wed Sep 03, 2008 11:16 am
  • Posts: 356
  • GitHub: apm
  • Gists: apm
  • Offline
  • Profile
Tags:

Re: Focus/blur delegation in IE?

Post Posted: Fri Aug 07, 2009 5:13 pm
+0-
The beta release went out with a broken focus/blur implementation for IE. It has been fixed for some time on github. To make it work with the beta release, you would need to check Y.UA to identify the browser and use 'focusout' instead of 'blur' if IE was detected.

Josh Lizarraga

YUI Contributor

  • Offline
  • Profile

Re: Focus/blur delegation in IE?

Post Posted: Fri Aug 07, 2009 6:04 pm
+0-
Doh! Every time I think the library is at fault, it's my code, and every time I think it's my code, it's the library! :lol:

Thanks a bunch for clearing that up, Adam!

Josh Lizarraga

YUI Contributor

  • Offline
  • Profile
Tags:

Re: Focus/blur delegation in IE?

Post Posted: Mon Aug 10, 2009 10:01 am
+0-
Hm, seems that using "focusin" and "focusout" doesn't work for IE with the beta release either:

<input id="demo" type="text" />

<script src="http://yui.yahooapis.com/3.0.0b1/build/yui/yui-min.js" type="text/javascript"></script>
<script type="text/javascript">

YUI().use('event', function(Y){

Y.on('focusout', function(){alert('blur')}, '#demo');

});

</script>

I have never used github before - what exactly should I be downloading?

Thanks!

Adam Moore

YUI Contributor

  • Username: adam
  • Joined: Wed Sep 03, 2008 11:16 am
  • Posts: 356
  • GitHub: apm
  • Gists: apm
  • Offline
  • Profile

Re: Focus/blur delegation in IE?

Post Posted: Mon Aug 10, 2009 10:09 am
+0-
Once git is installed: git clone git://github.com/yui/yui3.git

Github has a number of resources to get you familiarized with their system.

The events are probably not working because they are not white listed. You can try adding them by specifying the following before binding the listeners:

Y.Node.DOM_EVENTS.focusin = true;
Y.Node.DOM_EVENTS.focusout = true;

Josh Lizarraga

YUI Contributor

  • Offline
  • Profile

Re: Focus/blur delegation in IE?

Post Posted: Wed Aug 12, 2009 2:26 pm
+0-
White listing the events works *perfectly*.

Thanks again for all your help Adam!
  [ 6 posts ]
Display posts from previous:  Sort by  
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