// Is it a simple selector
isSimple = /^.[^:#\[\.,]*$/,
+ // Check if a string has a non-whitespace character in it
+ rnotwhite = /\S/,
+
+ // Used for trimming whitespace
+ rtrim = /^\s+|\s+$/g,
+
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent.toLowerCase(),
// Evalulates a script in a global context
globalEval: function( data ) {
- if ( data && /\S/.test(data) ) {
+ if ( data && rnotwhite.test(data) ) {
// Inspired by code by Andrea Giammarchi
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
var head = document.getElementsByTagName("head")[0] || document.documentElement,
},
trim: function( text ) {
- return (text || "").replace( /^\s+|\s+$/g, "" );
+ return (text || "").replace( rtrim, "" );
},
makeArray: function( array ) {