AnantLabs / rdfquery

Automatically exported from code.google.com/p/rdfquery
0 stars 0 forks source link

Regex#test() function is Used Incorrectly #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Regex#test() matches the pattern anywhere in the string, but often the
intent is to only match the entire string. Such as on line 113 linked below.
http://code.google.com/p/rdfquery/source/browse/trunk/jquery.rdfa.js#113

The regex expressions should be changed to use ^ and $ symbols to match the
entire string.

The correct usage should be something like:
/^about$|^href$|^src$|^resource$|^property$|^typeof$|^content$|^datatype$/.test(
a.nodeName)

Original issue reported on code.google.com by james-no...@leighnet.ca on 2 Nov 2009 at 3:13

GoogleCodeExporter commented 9 years ago

Original comment by jeni.ten...@gmail.com on 2 Nov 2009 at 4:38