PDA

View Full Version : [FIXED-1403] getAttribute in IE8



zombeerose
23 Nov 2010, 1:46 PM
Ext version tested:
Ext 3.3 rev 0


Adapter used:
ext


css used:
only default ext-all.css




Browser versions tested against:
IE8
FF3 (firebug 1.5.4 installed)
Chrome


Operating System:
WinXP Pro


Description:
The getAttribute function of Ext.Element does not work as expected for IE8.


Test Case:
Given the example dom structure:


<div resourceid="1246" contentid="405" id="example-ct">
<!-- junk in the trunk -->
</div>


This code should return value "1246":


Ext.get('example-ct').getAttribute('resourceid')



Steps to reproduce the problem:
see above

The result that was expected:
value of "1246"

The result that occurs instead:
FF: "1246"
Chrome: "1246"
IE8: undefined

Screenshot or Video:
none


Debugging already done:
none


Possible fix:
After looking at the getAttribute code, I believe that IE8 should not be using the IE function b/c "this.dom.getAttribute" now exists.

jsakalos
23 Nov 2010, 1:53 PM
If you think this is a bug (it looks like) I can move this thread to Bugs forum. Do you want me to move it?

zombeerose
23 Nov 2010, 2:03 PM
Sure - thx Saki! I reformatted as bug.

hendricd
23 Nov 2010, 3:20 PM
@zomberose--

Feature detection is usually preferred. Give this override a shot and report back on your results:


Ext.override(Ext.Element, {

getAttribute : 'getAttribute' in document.createElement('div') ?
function(name, ns){
var d = this.dom;
return (d.getAttributeNS ? d.getAttributeNS(ns, name) : null) ||
(ns ? d.getAttribute(ns + ":" + name) : d.getAttribute(name) || d[name]);
}:
function(name, ns){ //likely IE < 8
var d = this.dom,
attrib = ns ?
(!(/undefined|unknown/).test(typeof (attrib = d[ ns + ":" + name ])) ? attrib : undefined):
d[name];
return attrib || '';
}

});

zombeerose
24 Nov 2010, 6:14 AM
Thanks!

IE8 - yes
IE7 - yes
FF3 - yes
Chrome - yes

devtig
3 Dec 2010, 1:40 PM
Can't believe that this basic functionality is not working. Will this fix be in 3.3.2?

meroy
3 Dec 2010, 11:02 PM
Thanks for the report. This has been fixed in SVN.

cutelaw
14 Dec 2010, 3:37 AM
Now we get an error message in IE8 when using "Ext.QuickTips.init();"
Same issue as described here:
http://ajnasz.hu/tests/ie-table-attribute-bug.html

meroy
14 Dec 2010, 11:21 AM
Now we get an error message in IE8 when using "Ext.QuickTips.init();"


I'm not seeing a problem with IE8 using "Ext.QuickTips.init();" and Ext JS 3.3.x in SVN.

devtig
14 Dec 2010, 11:35 AM
cutelaw's websites generates the error in my IE7