Alien-GvaScript
view release on metacpan or search on metacpan
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
for (var i = 0; i < attrs.length; i++) {
var val = attrs[i].value;
var delim = val.indexOf('"') > -1 ? "'" : '"';
str += " " + attrs[i].name + "=" + delim + val + delim;
}
return str + ">" + elem.innerHTML + "</" + tag + ">";
}
}
});
Class.checkOptions = function(defaultOptions, ctorOptions) {
ctorOptions = ctorOptions || {}; // options passed to the class constructor
for (var property in ctorOptions) {
if (defaultOptions[property] === undefined)
throw new Error("unexpected option: " + property);
}
return Object.extend(Object.clone(defaultOptions), ctorOptions);
};
Object.extend(Event, {
detailedStop: function(event, toStop) {
if (toStop.preventDefault) {
if (event.preventDefault) event.preventDefault();
else event.returnValue = false;
}
if (toStop.stopPropagation) {
if (event.stopPropagation) event.stopPropagation();
else event.cancelBubble = true;
}
},
stopAll: {stopPropagation: true, preventDefault: true},
stopNone: {stopPropagation: false, preventDefault: false}
});
function ASSERT (cond, msg) {
if (!cond)
throw new Error("Violated assertion: " + msg);
}
// detects if a global CSS_PREFIX has been set
// if yes, use it to prefix the css classes
// default to gva
function CSSPREFIX () {
if(typeof CSS_PREFIX != 'undefined') {
return (CSS_PREFIX)? CSS_PREFIX : 'gva';
}
return 'gva';
}
/**
*
* Cross-Browser Split 1.0.1
* (c) Steven Levithan <stevenlevithan.com>; MIT License
* in order to fix a bug with String.prototype.split(RegExp) and Internet Explorer
* [http://blog.stevenlevithan.com/archives/cross-browser-split]
* An ECMA-compliant, uniform cross-browser split method
*
* */
var cbSplit;
// avoid running twice, which would break `cbSplit._nativeSplit`'s reference to the native `split`
if (!cbSplit) {
cbSplit = function (str, separator, limit) {
// if `separator` is not a regex, use the native `split`
if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
return cbSplit._nativeSplit.call(str, separator, limit);
}
var output = [],
lastLastIndex = 0,
flags = (separator.ignoreCase ? "i" : "") +
(separator.multiline ? "m" : "") +
(separator.sticky ? "y" : ""),
separator = RegExp(separator.source, flags + "g"), // make `global` and avoid `lastIndex` issues by working with a copy
separator2, match, lastIndex, lastLength;
str = str + ""; // type conversion
if (!cbSplit._compliantExecNpcg) {
separator2 = RegExp("^" + separator.source + "$(?!\\s)", flags); // doesn't need /g or /y, but they don't hurt
}
/* behavior for `limit`: if it's...
- `undefined`: no limit.
- `NaN` or zero: return an empty array.
- a positive number: use `Math.floor(limit)`.
- a negative number: no limit.
- other: type-convert, then use the above rules. */
if (limit === undefined || +limit < 0) {
limit = Infinity;
} else {
limit = Math.floor(+limit);
if (!limit) {
return [];
}
}
while (match = separator.exec(str)) {
lastIndex = match.index + match[0].length; // `separator.lastIndex` is not reliable cross-browser
if (lastIndex > lastLastIndex) {
output.push(str.slice(lastLastIndex, match.index));
// fix browsers whose `exec` methods don't consistently return `undefined` for nonparticipating capturing groups
if (!cbSplit._compliantExecNpcg && match.length > 1) {
match[0].replace(separator2, function () {
for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undefined) {
match[i] = undefined;
}
}
});
}
if (match.length > 1 && match.index < str.length) {
( run in 1.338 second using v1.01-cache-2.11-cpan-efa8479b9fe )