prototypejs / prototype

Prototype JavaScript framework
http://prototypejs.org/
Other
3.53k stars 639 forks source link

Not searching for null value for elementClassName in prototypejs 1.7 #329

Open Nabarun opened 7 years ago

Nabarun commented 7 years ago

In prototypejs 1.5 we were verifying for null value which we are not doing in 1.7

Current 1.7 version has the following

hasClassName: function(element, className) { if (!(element = $(element))) return; var elementClassName = element.className; return (elementClassName.length > 0 && (elementClassName == className || new RegExp("(^|\s)" + className + "(\s|$)").test(elementClassName))); },

In 1.5 we were having the following

hasClassName: function(element, className) { if (!(element = $(element))) return; var elementClassName = element.className; if (elementClassName == null || elementClassName.length == 0) return false; if (elementClassName == className || elementClassName.match(new RegExp("(^|\s)" + className + "(\s|$)"))) return true; return false; },

Because of this issue one of my existing feature was breaking. I solved the issue by adding if(typeof elementClassName === "undefined") return false; to 1.7 version

Let me know if this is intended or can be considered as bug