X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=js%2Fbehaviour.js;h=b225ca204f76609385c51aa0af0dc49f0e1213fa;hb=da7df35c61205d0b1af47d286be591b8a3194b0c;hp=a5ed0480fa74a9b3845fe734b11c79f95672de0d;hpb=b6e02a1b31e729c7b599b2e6f16a88cc30caa351;p=fa-stable.git diff --git a/js/behaviour.js b/js/behaviour.js index a5ed0480..b225ca20 100644 --- a/js/behaviour.js +++ b/js/behaviour.js @@ -200,19 +200,19 @@ document.getElementsBySelector = function(selector) { checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); }; break; case '~': // Match one of space seperated words - checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); }; + checkFunction = function(e) { var a=e.getAttribute(attrName); return (a && a.match(new RegExp('\\b'+attrValue+'\\b'))); }; break; case '|': // Match start with value followed by optional hyphen - checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); }; + checkFunction = function(e) { var a=e.getAttribute(attrName); return (a && a.match(new RegExp('^'+attrValue+'-?'))); }; break; case '^': // Match starts with value - checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); }; + checkFunction = function(e) { var a=e.getAttribute(attrName); return (a && a.indexOf(attrValue) == 0); }; break; case '$': // Match ends with value - fails with "Warning" in Opera 7 - checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); }; + checkFunction = function(e) { var a=e.getAttribute(attrName); return (a && a.lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); }; break; - case '*': // Match ends with value - checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); }; + case '*': // Match contains value + checkFunction = function(e) { var a=e.getAttribute(attrName); return (a && a.indexOf(attrValue) > -1); }; break; default : // Just test for existence of attribute