Ticket #2529282 (closed defect)
Reporter Jeroen Versteeg |
Opened: 09/6/10 Last modified: 08/18/11 Status: closed Type: defect Resolution: fixed |
Owner Luke Smith |
Target Release: 3.4.0 Priority: P3 (normal) |
|---|---|---|---|
| Summary: | Y.on( 'available' ) docs need to be clear about wanting a selector | ||
| Description: |
Throws JS errors: "s.replace is not a function" and "J.match is not a function". In both cases, the object (s/J) is the DOM Node instead of a Y.Node object. See the URL I provided for a simple test case. The expected outcome is that the input gets focus when it's available. A propos: What I'm trying to do is focus() on an input I create (and append) through Y.Node. The code in the example shouldn't throw errors, but maybe I'm going about this the wrong way anyway? |
||
| Type: | defect | Observed in Version: | 3.1.2 |
| Component: | Event | Severity: | S3 (normal) |
| Assigned To: | Luke Smith | Target Release: | 3.4.0 |
| Location: | API Documentation | Priority: | P3 (normal) |
| Tags: | Relates To: | ||
| Browsers: | Firefox 3.x - All,IE 7.x,IE 8.x | ||
| URL: | http://www.jayvee.nl/yuitest/buggy.html | ||
| Test Information: | |||
Change History
|
Posted: 09/6/10
|
|
Posted: 09/7/10
[code] var inp = Y.one( '#main input' ); [code] [/code] The input field doesn't have a load event. |
|
Posted: 09/7/10
Ah, I hadn't realized 'available' requires a selector! Now that I look at the example, it isn't very clear! I think this deserves some notice as it differs from other events. Secondly, wouldn't it be better to have Y.on throw an Exception (or return null) if the wrong parameter type is used for 'available'? My issue is solved anyway, thanks for the quick feedback! |
|
Posted: 09/7/10
|
|
Posted: 09/21/10
Adam, would it be possible to make Y.on( 'available' ) accept Y.Node instances as well as selectors? I often have problems with IE(7) if I try to do something to nodes immediately after I've append()ed them to the DOM (e.g. simulate( 'focus') or apply an Anim()ation). Providing a selector pretty much requires an id (other ways of ensuring a particular unique element is selected are difficult, especially when you're creating DOM nodes dynamically), but I usually don't set one because it's not needed. What I'm proposing is that Y.on( 'available' ) accepts a Y.Node. To implement, maybe it could then just use the nodes _yuid property to build a selector by itself? Alternatively, is there some other way of delaying code until they're ready in IE (and other "slow" browsers)? |
|
Posted: 09/21/10
Why are you using the available event at all? That element should already be available, so that line should just be: |
|
Posted: 09/22/10
Consider [url=http://www.jayvee.nl/yuitest/available.html]this example[/] Y.on( 'available', function () { // not required in FF I've got something very similar (but more complex) in a page and it works. Could it be that because this page is so small IE gets into timing issues? |
|
Posted: 10/27/10
|
|
Posted: 04/20/11
|
|
Posted: 04/28/11
I'll update the docs to be more explicit about 'available' and 'contentready' needing selectors. For support with your use case, please ask in the forums (http://yuilibrary.com/forum) or in the #yui irc channel on irc.freenode.org. |
|
Posted: 06/28/11
|
|
Posted: 07/27/11
|
|
Posted: 08/18/11
|
Addendum: In the description's first line, "Y.one" should be "Y.on" of course.