Reputation: 380
I am developing a web application using GWT
. The application is working fine in both FF and chrome. When I run it in IE9, I receive "Error: DOM Exception: INVALID_CHARACTER_ERR (5)".
When I review the code that caused the exception is in the creation of a ListBox
as below
comboBox = new ListBox(false);
and in the compiled Javascript is:
this["@com.google.gwt.dom.client.DOMImplTrident::createSelectElement(Lcom/google/gwt/dom/client/Document;Z)"] = function(doc, multiple) {
var html = multiple?'<SELECT MULTIPLE>':'<SELECT>';
return doc.createElement(html);
}
How can I resolve this problem?
Thanks and Regards,
Haider
Upvotes: 2
Views: 2474
Reputation: 1821
I was running into this with an old GWT app. Instead of touching GWT (who wants to do that), I found it easier to patch the browser method to support GWT's incorrect document.createElement usage.
Here's the gist that should be dropin-able: https://gist.github.com/cmawhorter/b688401e00220c4a1af2
Now document.createElement('<SELECT MULTIPLE>')
works as gwt expects, app loads, and all is once again right with the world.
Resolved the problem for me in a fairly complex app.
Upvotes: 0
Reputation: 1043
Upgrade to gwt 2.3.0, this bug has been fixed in http://code.google.com/p/google-web-toolkit/issues/detail?id=5125.
Upvotes: 2
Reputation: 7535
The underlying cause is outlined in Invalid Character DOM Exception in IE9 - essentially IE 9 now follows the W3C DOM Level 1 standard in its implementation of document.createElement
.
Previously you could create an element like this:
document.createElement('<div>');
this isn't as per the standard and now you can only pass the element name as an argument, e.g.:
document.createElement('div');
The invalid character is presumably because <
(and >
) are invalid character in element names.
Upvotes: 2
Reputation: 380
I fixed it by adding the following line to the xml file
<set-property name="user.agent" value="safari" />
Upvotes: 1
Reputation: 12538
A DOMException.INVALID_CHARACTER_ERR is thrown whenever an invalid or illegal character is specified, such as in a name.
Names in XML can contain English letters (of any case), numbers (0-9), underscores (_), periods(.) and hyphens (-). Names cannot begin with a number, period or hyphen. Names can also contain a colon, but the use of colons outside of namespaces should be avoided.
See if you are violating this rule on the HTML rendered on the page. Compare the HTML page together with the line number of the error and fix it.
Upvotes: 0