View Full Version : getDom not w3c standard
Nexcet
14 Aug 2008, 8:11 AM
I get the following warning message from firefox "Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead" whenever I use it!
So what's the deal with that? getDom is not set/program correctly in Ext JS by W3C standard...
:-?
mystix
14 Aug 2008, 8:15 AM
i just ran
Ext.getDom('ext-comp-1010');
in firebug on one of my app's pages and it returned me the HTMLElement just fine -- no complaints.
what exactly did you do to obtain that mumble from FF?
[edit]
p.s. i'm on Ext 2.2.
Nexcet
14 Aug 2008, 9:33 AM
i just ran
Ext.getDom('ext-comp-1010');
in firebug on one of my app's pages and it returned me the HTMLElement just fine -- no complaints.
what exactly did you do to obtain that mumble from FF?
[edit]
p.s. i'm on Ext 2.2.
new Ext.form.TextField(
{
fieldLabel: 'Email',
name: 'email',
id: 'email',
allowBlank: false
});
email_field = Ext.getDom(email);
email_field.disabled = false;
It works! But it's not standard.
mystix
14 Aug 2008, 9:43 AM
if you're referring to the warnings in the FF js console, then you'll see an additional crapload of warnings about invalid css rules too. ;)
and just for kicks, try validating the generated html with the w3c html validator tool.
and now for a(n) (overly?) sweeping statement:
if you're dreaming of conforming to w3c standards, all (except maybe yui?) RIA js libs will fail.
and to top it all off --- if you dig into the /source/core/Ext.js file, you'll see this piece of code:
/**
* Return the dom node for the passed string (id), dom node, or Ext.Element
* @param {Mixed} el
* @return HTMLElement
*/
getDom : function(el){
if(!el || !document){
return null;
}
return el.dom ? el.dom : (typeof el == 'string' ? document.getElementById(el) : el);
},
pretty self-explanatory, eh? B)
[edit]
your code gets the TextField's underlying input field, and disables that.
you should be doing
Ext.getCmp('email').setDisabled(true);
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.