View Full Version : getEl() weirdness...
rob30UK
14 Jan 2007, 12:32 PM
When i try and do:-
getEl("doc").style.fontSize = "15px";
I get a javascript error: getEl("doc") has no properties
I cant understand why i cant set the fontSize this way....
Any ideas?
tryanDLS
14 Jan 2007, 12:45 PM
getEl does not return a Dom object. It returns an Element object which wraps a Dom object. The Element object has methods for doing things like setting styles. See this link for an intro to the Element object http://yui-ext.com/manual
brian.moeskau
14 Jan 2007, 9:42 PM
One other thing that will make your life much easier (in addition to RTFM :)) is using Firebug debugging to full advantage. Change your code to:
var el = getEl("doc");
el.style.fontSize = "15px";
Then set a breakpoint on the first line and inspect el's properties in the Firebug Watch window. You'll plainly see by the interface that el has all kinds of methods and properties that look nothing at all like a DOM element ;). This approach makes it much easier to verify exactly what object type you are dealing with when you're unsure or having issues like this.
rob30UK
16 Jan 2007, 5:24 PM
Thanks, this does help for debugging.
I am getting very put off yui and everything now, because i use a menubar with animated dropdowns along with this dialog.
The menus are extremely slow and jumpy on a good few browsers.
It seems to me like YUI has a huge memory / code footprint. It's a shame you cant build your YUI core like you can the ext core coz I'm sure I'm loading an awful lot of crap i dont need. (yes, I'm using min files).
I also tried pasting all javascripts into one minified file and that doesnt speed anything up either.
tryanDLS
16 Jan 2007, 8:15 PM
If you think you're having peformance issues with the yui code, I suggest you post a question in their forum. That code base is in pretty wide use and I would think that you'd get plenty of feedback regarding performance issues.
Also, I'm sure that they could recommend ways to reduce the footprint of their code. Certainly you can start with utilities + menu and add from there.
Animal
17 Jan 2007, 1:45 AM
The YUI menu is a monster though. I'm hoping Jack will come up with something better :D
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.