nitrogen.js "Object expected" error in IE8
Reported by Brian O | April 27th, 2010 @ 12:41 PM | in 2.0.1
In Internet Explorer 8, NitrogenClass.prototype.$make_id() triggers an error:
Object expected nitrogen.js, line 110 character 2
The reason is that the "matches" variable is null when match doesn't match anything, and apply doesn't expect that. We can patch this with:
diff --git a/apps/nitrogen/www/nitrogen.js b/apps/nitrogen/www/nitrogen.js
index 3c9e17d..b9a2c5e 100644
--- a/apps/nitrogen/www/nitrogen.js
+++ b/apps/nitrogen/www/nitrogen.js
@@ -107,7 +107,9 @@ NitrogenClass.prototype.$make_id = function(element) {
var re = new RegExp("\.wfid_(.[^\\s]*)", "g");
while(element && element.className) {
var matches = element.className.match(/wfid_([^\s])+/g);
- a.unshift.apply(a, matches);
+ if (matches) {
+ a.unshift.apply(a, matches);
+ }
element = element.parentNode;
}
As a matter of code hygiene, we can probably also remove the "var re = ..." line, since it doesn't appear to be used.
Comments and changes to this ticket
-
Brian O May 3rd, 2010 @ 04:57 PM
This should be fixed with changeset 536bbf669a26d5f97526703525977135d467a550
-
Rusty Klophaus June 14th, 2010 @ 06:40 PM
- Milestone set to 2.0.1
- State changed from new to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Nitrogen Web Framework for Erlang