tests for field based

This commit is contained in:
Julian Dolby 2014-05-28 13:31:05 -04:00
parent ae595088a3
commit 97f5c88b5e
3 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,26 @@
<HTML>
<TITLE>Tests of random constructs</TITLE>
Hi
<SCRIPT>
$ = function dollar(x) {
if ((typeof x) === "function") {
x();
} else {
document.write(x);
}
};
$(function bad_guy(){
try { $(location.hash) } catch(e) {}
});
</SCRIPT>
<BR>
Welcome to our system
</HTML>

View File

@ -0,0 +1,33 @@
<HTML>
<TITLE>Tests of random constructs</TITLE>
Hi
<SCRIPT>
var x = function dollar(selector) {
return new x.fn.init(selector);
}
x.fn = { };
x.fn.init = function dollar_init(x) {
if ((typeof x) === "function") {
x();
} else {
document.write(x);
}
};
window.$ = x;
$(function bad_guy(){
try { $(location.hash) } catch(e) {}
});
</SCRIPT>
<BR>
Welcome to our system
</HTML>

View File

@ -0,0 +1,55 @@
<HTML>
<TITLE>Tests of random constructs</TITLE>
Hi
<SCRIPT>
var x = function dollar(selector) {
return new x.fn.init(selector);
}
x.fn = { };
x.fn.init = function dollar_init(selector) {
var quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/;
var rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
if ((typeof selector) === "function") {
selector();
} else if ((typeof selector) === "string") {
var match;
if ( selector.charAt(0) === "<" &&
selector.charAt( selector.length - 1 ) === ">" &&
selector.length >= 3 )
{
match = [ null, selector, null ];
} else {
match = quickExpr.exec( selector );
}
if ( match && (match[1] || !context) ) {
if ( match[1] ) {
ret = rsingleTag.exec( selector );
if ( ret ) {
document.createElement( "xx" ).innerHTML = ret[1];
}
}
}
}
};
window.$ = x;
$(function bad_guy(){
try { $(location.hash) } catch(e) {}
});
</SCRIPT>
<BR>
Welcome to our system
</HTML>