/*
PQ普通的选择器(不支持伪类,由ZERONETA编写为PQ库在WA骨架上使用)
从PQ库上独立出来的,有些函数是补上去的,供大家参考或者嵌入到自己的JS开发库
*/
;var PQ = function()
{
var
pq = 1, //是否只使用PQ作为首选选择器,设置 0 时当浏览器支持原生选择器使用原生选择器,在原生选择器语法提示出错时再次尝试使用PQ选择器
$q = /(\.|#)(\w+)/g,
$w = /^\s*(\w+)/,
$e = /^\[(\w+)\s*(?:(CLASS|ID|\!\=|\$\=|\*\=|\=|\^\=|\~\=|\|\=)\s*(\'|\")?([\w\u00c0-\uFFFF\-]+)\3)?\]/,
$r = /^\s*( |\+|\>|~)\s*(?=\w|\[)/,
_q = 0,
_w = /(,)?([^,]+)/g,
_e = Array.prototype.slice,
_r = document.createElement( 'div' ),
root = document,
pack = Function,
string = String,
syntax = RegExp,
trying = function( q ){ try { return q.apply( this, _e.call( arguments, 1 ) ); } catch ( w ) {}; },
in_array = Array.prototype.indexOf || function( q ){ for ( var q in this ){ if ( this[ q ] == q ){ return q; }; }; return -1; },
contains = _r.compareDocumentPosition
? function( q, w )
{
return q !== w && q.compareDocumentPosition( w ) === 20;
}
: function( q, w )
{
if ( q !== w )
{
if ( q.contains )
{
return q.contains( w );
};
while ( w = w.parentNode )
{
if ( q === w )
{
return true;
};
};
};
return false;
};
function $t( q, w, e )
{
return '[' + ( w === '.' ? '_ CLASS ' : '_ ID ' ) + e + ']';
};
function $y( q, w )
{
var e = [], r;
q = string( q ).replace( $q, $t ), w = w || document;
if ( q.indexOf( ',' ) === -1 )
{
$i( q, w, e );
return e;
};
for ( q = q.split( ',' ), r = 0; r < q.length; $i( q[ r++ ], w, e ) );
for ( q = [], w = 0; w < r; ++r )
{
if ( in_array.call( q, e[ w ] ) )
{
q[ q.length ] = e[ w ];
};
};
return q;
};
function $u( q, w, e )
{
if ( q.hasAttribute )
{
return q.hasAttribute( w );
};
i = q.getAttributeNode && q.getAttributeNode( w );
return i ? i.specified : q.getAttribute( w ) !== null;
};
function $i( q, w, e, r )
{
var t = '*', y = 1, u, i;
if ( $w.test( q ) )
{
q = syntax.rightContext,
t = syntax.$1.toUpperCase(),
y = 'q.tagName==="' + t + '"';
};
while ( $e.test( q ) )
{
q = syntax.rightContext;
switch ( syntax.$2 )
{
case 'CLASS':
y += '&&(" "+q.className.toUpperCase()+" ").indexOf(" ' + syntax.$4.toUpperCase() + ' ")!==-1';
continue;
case 'ID':
y += '&&q.id.toUpperCase()==="' + syntax.$4.toUpperCase() + '"';
continue;
case '!=':
y += '&&(w=q.getAttribute("' + syntax.$1 + '"))&&w!=="' + syntax.$4 + '"';
continue;
case '$=':
y += '&&(w=q.getAttribute("' + syntax.$1 + '"))&&w.slice(-' + syntax.$4.length + ')==="' + syntax.$4 + '"';
continue;
case '*=':
y += '&&(w=q.getAttribute("' + syntax.$1 + '"))&&w.indexOf("' + syntax.$4 + '")!==-1';
continue;
case '=':
y += '&&q.getAttribute("' + syntax.$1 + '")==="' + syntax.$4 + '"';
continue;
case '^=':
y += '&&(w=q.getAttribute("' + syntax.$1 + '"))&&w.substring(0,' + syntax.$4.length + ')==="' + syntax.$4 + '"';
continue;
case '~=':
y += '&&(w=q.getAttribute("' + syntax.$1 + '"))&&(" "+w+" ").indexOf(" ' + syntax.$4 + ' ")!==-1';
continue;
case '|=':
y += '&&(w=q.getAttribute("' + syntax.$1 + '"))&&(w+"-").substring(0,' + ( syntax.$4.length + 1 ) + ')==="' + syntax.$4 + '-"';
continue;
default:
y += '&&this(q,"' + syntax.$1 + '")';
};
};
if ( y === 1 )
{
return;
};
y = pack( 'q', 'var w;return ' + y );
if ( u = $r.test( q ) )
{
q = syntax.rightContext, i = syntax.$1;
};
switch ( r )
{
case '+':
for ( t = w.nextSibling; t; t = t.nextSibling )
{
if ( t.nodeType === 1 )
{
if ( y.call( $u, t ) )
{
u ? $i( q, t, e, i ) : e[ e.length ] = t;
};
return;
};
};
return;
case '>':
for ( t = w.childNodes, r = 0; r < t.length; ++r )
{
if ( t[ r ].nodeType === 1 && y.call( $u, t[ r ] ) )
{
u ? $i( q, t[ r ], e, i ) : e[ e.length ] = t[ r ];
};
};
return;
case '~':
for ( t = w.nextSibling; t; t = t.nextSibling )
{
if ( t.nodeType === 1 && y.call( $u, t ) )
{
u ? $i( q, t, e, i ) : e[ e.length ] = t;
};
};
return;
default:
if ( u )
{
switch ( i )
{
case ' ':
for ( t = w.getElementsByTagName( t ), r = 0, w = t[0]; r < t.length; ++r )
{
if ( y.call( $u, t[ r ] ) )
{
contains( w, t[ r ] ) || $i( q, w = t[ r ], e, i );
};
};
return;
case '~':
for ( t = w.getElementsByTagName( t ), r = 0, w = []; r < t.length; ++r )
{
if ( y.call( $u, t[ r ] ) && in_array.call( w, t[ r ].parentNode ) === -1 )
{
w[ w.length ] = t[ r ].parentNode,
$i( q, t[ r ], e, i );
};
};
return;
default:
for ( t = w.getElementsByTagName( t ), r = 0; r < t.length; ++r )
{
y.call( $u, t[ r ] ) && $i( q, t[ r ], e, i );
};
};
return;
};
for ( t = w.getElementsByTagName( t ), r = 0; r < t.length; ++r )
{
if ( y.call( $u, t[ r ] ) )
{
e[ e.length ] = t[ r ];
};
};
};
};
function _t( q, w )
{
if ( w.nodeType === 9 )
{
return w.querySelectorAll( q );
};
_r = w.id,
w.id = 'pq_query_node_id' + ++_q,
q = w.querySelectorAll( q.replace( _w, '$1#' + w.id + ' $2' ) ),
_r ? w.id = _r : w.removeAttribute( 'id' );
return q;
};
if ( !pq && _r.querySelectorAll )
{
_r.innerHTML = '<a/>',
_r = _r.querySelectorAll( 'div a' );
if ( _r.length === 0 )
{
_t = function( q, w )
{
return w.querySelectorAll( q );
};
};
if ( typeof _r === 'array' )
{
return function( q, w )
{
return trying( _t, q, w || root ) || $y( q, w );
};
};
if ( !trying(function(){ return _e.call( _r ); }) )
{
_e = function()
{
for ( var q = [], w = 0; w < this.length; ++w )
{
q[ w ] = this[ w ];
};
return q;
};
};
return function( q, w )
{
var e = trying( _t, q, w || root );
return e ? _e.call( e ) : $y( q, w );
};
};
return $y;
}();
有开发WEB类程序员技术交流的吗 加群 456357348 交流 最好是有一定基础的 或有想法的
有关范围 Windows MySQL Apache PHP Node HTML JavaScript CSS 浏览器 缓存技术
分享到:
相关推荐
无聊的关机cpp 无聊的关机cpp 无聊的关机cpp 无聊的关机cpp
你需要一个无聊整人的小代码? 下载我就对了,主要是便宜啊,便宜啊 用Python运行后就会无限重复,如果你想要关掉,就直接把Python关掉算了 哈哈哈哈 其实代码本身也没多少,自己看着玩吧
STM32F103ZET6无聊的盒子代码,控制舵机和外部输入
用Bochs调试,gas和gcc编译...,但是有个问题,希望有空的朋友看下http://topic.csdn.net/u/20110217/22/4366e8fa-790e-460a-b8a0-f5f3319316fd.html,帮忙解决下...
php代码-纯属上班无聊,敲敲代码
有了数据库结构设计文档后,若直接按这个设计文档生成相应的代码,工作效率还是会显著提高,一方面可以从这个无聊的、没有什么创造性的工作里解放出来,另一方面生成好的代码质量也高一些,后期的维护也方便一些。...
sqlserver优化笔记,自己无聊的时候整理的一些优化笔记
无聊的电影选择器,但有React:) 在这里,我将尝试重新制作我的第一个应用程序。 我将使用: ReactJS 打字稿 TheMovieDB API
hjgjhbjklkjbnbmnvhjgcghnbkjbm,
“无聊软件”是经贸学院论坛追梦管理团队无聊工作室开发的一款方便实用、解闷的小工具,经过压缩,减小代码和结合网站实时更新的功能,使软件现有大小只有40K。 绿色、无毒、无需安装,方便实用。软件主要有“万能...
作这个工具的前提是因为老会重复着,每次确定表结构后,就开始无聊的实体类代码,接口类代码,数据库操作类代码,每次都重复写这些实在浪费时间,于是就自己给自己做了这个工具. 本工具支持导入数据结构文档,然后...
基于数独小项目的打包APP,提供给准备使用或者测试代码的人一个率先体验,csdn地址,https://blog.csdn.net/weixin_41191134/article/details/84983946
舵机版的无聊的盒子,通过舵机实现盒子的开关以及控制。
闲时无聊,用Java写了一个小时候经常玩的俄罗斯方块小游戏(里面有源代码和编译好的可执行jar包)。 运行环境jdk1.8 源码使用方法:打开eclipse,新建一个java project然后把tetris目录复制到project里的src目录下。
无聊的把 GitHub实时hosts 自动拉去下...记得分享。 Delphi11编写,无难度置为方便 (听说曝光能力值需要多写文字:) 1、压缩包包含三个文件 2、host.exe 是可执行文件 3、source.zip 是程序源代码 4、txt文件内有...
网上提供的开源的BAC NET源代码。为大家提供方便,同时也为我自己积累点分数。真是无聊,下点资料还弄个分数什么的。建议大家把资源分都设成0吧,方便他人也方便自己。
无聊自己的东西写的玩玩
无聊自己写的连连看,模范QQ C#(Winform)连连看小游戏开源代码