Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: EE-1.8.2.GA_P03
-
Fix Version/s: 1.8.3, EE-1.8.2.GA_P04
-
Component/s: Bridge
-
Labels:None
-
Environment:Chrome
Description
A JavaScript error is thrown when calling the iceSubmitPartial JavaScript code in a function that is called on the body tags onload method.
-
Hide
- Case10339Example.war
- 6.78 MB
- Arran Mccullough
-
- META-INF/MANIFEST.MF 0.1 kB
- META-INF/context.xml 0.1 kB
- WEB-INF/classes/.../example/TestBean.class 1 kB
- WEB-INF/faces-config.xml 0.6 kB
- WEB-INF/lib/backport-util-concurrent.jar 316 kB
- WEB-INF/lib/commons-beanutils.jar 223 kB
- WEB-INF/lib/commons-collections.jar 554 kB
- WEB-INF/lib/commons-digester.jar 137 kB
- WEB-INF/lib/commons-fileupload.jar 56 kB
- WEB-INF/lib/commons-logging.jar 51 kB
- WEB-INF/lib/icefaces-comps.jar 1.73 MB
- WEB-INF/lib/icefaces-facelets.jar 592 kB
- WEB-INF/lib/icefaces.jar 1.20 MB
- WEB-INF/lib/jsf-api-1.2.jar 347 kB
- WEB-INF/lib/jsf-impl-1.2.jar 818 kB
- WEB-INF/lib/jxl.jar 689 kB
- WEB-INF/.../krysalis-jCharts-1.0.0-alpha-1.jar 148 kB
- WEB-INF/web.xml 4 kB
- welcomeICEfaces.xhtml 1 kB
-
- Chrome_js_error.jpg
- 91 kB
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Deryk's correct, the event's 'srcElement' property is the HTMLDocument which does not have a 'tagName' property. A simpler solution that has been adopted lately is to use the 'nodeName' property instead because it always returns a string for any type of DOM node:
...
switch (e.nodeName.toLowerCase())
...
Show
Arran Mccullough
added a comment - Deryk's correct, the event's 'srcElement' property is the HTMLDocument which does not have a 'tagName' property. A simpler solution that has been adopted lately is to use the 'nodeName' property instead because it always returns a string for any type of DOM node:
...
switch (e.nodeName.toLowerCase())
...
Use Node.nodeName property to acquire the element's tag name, in case the passed in node does not have a tag name the 'nodeName' will still return a non-null name.
Show
Mircea Toma
added a comment - Use Node.nodeName property to acquire the element's tag name, in case the passed in node does not have a tag name the 'nodeName' will still return a non-null name.
Dev comments on cause of issue:
The error occurs here where it tries to get the tagName of the passed in element:
This.Element.adaptToElement = function(e) {
{ case 'textarea': case 'input': return new This.InputElement(e); case 'thead': case 'tfoot': case 'tbody': case 'th': case 'td': case 'tr': return new This.TableCellElement(e); case 'button': return new This.ButtonElement(e); case 'select': return new This.SelectElement(e); case 'form': return new This.FormElement(e); case 'body': return new This.BodyElement(e); case 'script': return new This.ScriptElement(e); case 'title': return new This.TitleElement(e); case 'a': return new This.AnchorElement(e); case 'iframe': return new This.IFrameElement(e); default : return new This.Element(e); }//no polymophism here...'switch' is the way then.
if (!e)
return new This.Element(e);
switch (e.tagName.toLowerCase())
};
Not sure why Chrome would have an issue with this compared to the other browsers. If I debug it a bit, it seems that during processing, the event.source is determined to be an HTMLDocument (which I guess makes a certain sense for the onload) but in Chrome, the HTMLDocument does not have a tagName attribute and this is what causes the exception to be thrown. I guess a fix would be to check for e.tagName and just return This.Element(e) for that as well:
This.Element.adaptToElement = function(e) {
//no polymophism here...'switch' is the way then.
if (!e)
return new This.Element(e);
if (!e.tagName)
return new This.Element(e);
switch (e.tagName.toLowerCase()) {
case 'textarea':