From 0a7622cbeeefb73866130e41067cb1f940389daa Mon Sep 17 00:00:00 2001 From: shahzadamodassir <152081666+shahzadamodassir@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:16:53 +0530 Subject: [PATCH] update v1.5.0 on 18 January 2025 --- README.md | 6 +++--- bower.json | 2 +- dist/snizzle-min.js | 4 ++-- dist/snizzle.js | 29 ++++------------------------- package.json | 2 +- 5 files changed, 11 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index f06b838..ee8f994 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ - [Deployed source](https://jqrony.github.io/snizzle/dist/snizzle-min.js) ## New Features -Snizzle `v1.4.2` in new features included for related advance DOM-Element Selecting Snizzle library in added new features `XPath selenium` now user can be select DOM elements XPath through. +Snizzle `v1.5.0` in new features included for related advance DOM-Element Selecting Snizzle library in added new features `XPath selenium` now user can be select DOM elements XPath through. **Example** ```js @@ -39,7 +39,7 @@ Snizzle("/html/body/main/div/div[2]/section/nav/ul/li[3]"); ``` ## Contribution Guides -In order to build Snizzle, you should have Node.js/npm latest and git 1.4.2 or later (earlier versions might work OK, but are not tested). +In order to build Snizzle, you should have Node.js/npm latest and git 1.5.0 or later (earlier versions might work OK, but are not tested). For Windows you have to download and install git and [Node.js](https://nodejs.org/download/). @@ -62,7 +62,7 @@ As an alternative you can use the Yarn CLI command: ### Snizzle information For information on how to get started and how to use Snizzle, please see [Snizzle's](https://github.com/jqrony/snizzle) [documentation](https://github.com/jqrony/snizzle/wiki). For source files and issues, please visit the Snizzle repository. -If upgrading, please see the blog post for [release 1.4.2](https://github.com/jqrony/snizzle/releases/tag/1.4.2). This includes notable differences from the previous version and a more readable changelog. +If upgrading, please see the blog post for [release 1.5.0](https://github.com/jqrony/snizzle/releases/tag/1.5.0). This includes notable differences from the previous version and a more readable changelog. ## Including Snizzle Below are some of the most common ways to include Snizzle diff --git a/bower.json b/bower.json index 98879ca..edf2504 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "snizzle", - "version": "1.4.3", + "version": "1.5.0", "main": "dist/snizzle.js", "ignore": [ "node_modules", diff --git a/dist/snizzle-min.js b/dist/snizzle-min.js index b112abc..1f06f3e 100644 --- a/dist/snizzle-min.js +++ b/dist/snizzle-min.js @@ -1,2 +1,2 @@ -/** Snizzle is fast feature-rich CSS Selector Engine @version 1.4.3 Date: 13 January 2023 12:25 GMT+0530 */ -!function(e){var t,n,r,o,i,a,u,c,s,l,f,d,p,m,g,h,x,y,w,v="snizzle"+1*Date.now(),b=e.document,E={}.hasOwnProperty,N=[],C=N.indexOf,L=N.push,T=N.slice,A=N.concat,S=function(){m()},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped|muted",k="clip|color|cursor|direction|display|fill|filter|font|kerning|marker|mask|stroke|zoomandpan|xml:(?:lang|space|base)|clip-(?:path|rule)|lighting-color|points|d|viewbox|enable-background|fill-(?:opacity|rule)|flood-(?:color|opacity)|glyph-orientation-(?:horizontal|vertical)|image-rendering|stop-(?:color|opacity)|dominant-baseline|x1|x2|y1|y2|cx|cy|r|ry|stroke-(?:dasharray|dashoffset|linecap|linejoin|miterlimit|opacity|width)|text-rendering",$="[\\x20\\t\\r\\n\\f]",B="(?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",z="\\[[\\x20\\t\\r\\n\\f]*("+B+")(?:"+$+"*([*^$|!~]?=)"+$+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+B+"))|)"+$+"*\\]",q=$+"*\\b(\\)*)(\\/)\\b|((\\])\\/)"+$+"*",D="\\[[\\x20\\t\\r\\n\\f]*(?:(([\\w-]+)\\(\\@([\\w-]+),[\\x20\\t\\r\\n\\f]*['\"][\\x20\\t\\r\\n\\f]*(.*?)[\\x20\\t\\r\\n\\f]*['\"])\\)|((?:first|last|odd|even|name)\\(\\))|(\\@[\\w-]+[\\x20\\t\\r\\n\\f]*=[\\x20\\t\\r\\n\\f]*['\"]*(.*?)['\"]*)|(([\\w-]+)\\(\\@(.*?)\\))|(\\@[\\w-]+)|([\\w-]+\\(\\))[\\x20\\t\\r\\n\\f]*=['\"]*[\\x20\\t\\r\\n\\f]*(.*?)[\\x20\\t\\r\\n\\f]*['\"]*|([\\w-]+)\\([\\x20\\t\\r\\n\\f]*([\\w-]+\\(\\)),[\\x20\\t\\r\\n\\f]*['\"]*(.*?)['\"]*\\))[\\x20\\t\\r\\n\\f]*\\]",O=new RegExp("^[\\x20\\t\\r\\n\\f]*,[\\x20\\t\\r\\n\\f]*"),I=new RegExp("([\\w-]+)\\[[\\x20\\t\\r\\n\\f]*(\\d+)[\\x20\\t\\r\\n\\f]*\\]","g"),F=new RegExp("^(?:theme-color|apple-mobile-web-app-status-bar-style|msapplication-TileColor|msapplication-navbutton-color)$","i"),H=/^(?:input|select|textarea|button)/i,U=new RegExp($+"+","g"),j=new RegExp("^"+B+"$"),M=new RegExp("([\\w-]+)[\\x20\\t\\r\\n\\f]*\\b(\\)*)(\\/)\\b|((\\])\\/)[\\x20\\t\\r\\n\\f]*following-sibling::([\\w-]+)|"+D),P=/^[^{]+\{\s*\[native \w/,G=/^\/(?:|\/\*)+/,V=new RegExp(q,"g"),K=/\/\s*$/,Q=/HTML$/i,X=/^h[1-6]$/i,J=/^(none)\s*(0s)\s*(ease)\s*(0s).*(running)/,W=/^(?:#(\s*[\w-]+\s*)|(\w+)|\.([\w-]+))$/,Y=new RegExp("^[\\x20\\t\\r\\n\\f]*([>+~=<]|[\\x20\\t\\r\\n\\f])[\\x20\\t\\r\\n\\f]*"),Z=new RegExp("^[\\x20\\t\\r\\n\\f]+|((?:^|[^\\\\])(?:\\\\.)*)[\\x20\\t\\r\\n\\f]+$","g"),_={inlineTag:new RegExp("^(?:img|input|meta|area|keygen|base|link|br|hr|command|col|param|track|wbr|embed|source)$","i"),bool:new RegExp("^(?:"+R+")$","i"),ID:new RegExp("^#("+B+")"),CLASS:new RegExp("^\\.("+B+")"),TAG:new RegExp("^("+B+"|[*])"),ATTR:new RegExp("^"+z),PSEUDO:new RegExp("^:((?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)"),nstag:new RegExp("^(?:svg|g|defs|desc|symbol|use|image|switch|set|circle|ellipse|line|polyline|animatetransform|mpath|foreignobject|linegradient|radialgradient|stop|pattern|polygon|path|text|tspan|textpath|tref|marker|view|rect|animatemotion|font|clippath|mask|filter|cursor|hkern|vkern|(?:font-(face)(?:.*|src|uri|format|name)))$","i"),nsattr:new RegExp("^(?:"+k+")$"),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),needsContext:new RegExp("^[\\x20\\t\\r\\n\\f]*[>+~=<]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)","i")};function ee(e,t,n,r){var o,i,a,u,s=t&&t.ownerDocument,l=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==l&&9!==l&&11!==l)return g;if(!r&&(m(t),t=t||g,x&&11!==l&&(i=W.exec(e))))return(o=i[1])?((a=9===l?t.getElementById(o):s&&s.getElementById(o))&&n.push(a),n):(o=i[3],a=i[2]?t.getElementsByTagName(e):o&&t.getElementsByClassName(o),L.apply(n,a),n);if(e="/"===e?":root":e.replace(G,"").replace(I,"$1:nth-of-type($2)").replace(V,(function(e,t,n){return(arguments[4]||t)+" > "})),M.test(e)){u=new RegExp(D,"g");var f={"starts-with":"^=",contains:"*=","ends-with":"$="};e=e.replace(u,(function(e,t,n,r,o,i,a,u,c,s,l,d){return n&&r&&o?"["+r+f[n]+o+"]":c&&s&&l?":"+s+"(["+l+"])":i?":"+i:a&&u||d?"["+(a||d).replace("@","")+"]":void 0}))}return c(e.replace(Z,"$1"),t,n,r)}function te(e){return e[v]=!0,e}function ne(e){var t=g.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function re(e){return d((function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.disabled===e||t.disabled!==!e:t.disabled===e:"label"in t&&t.disabled===e}))}function oe(e){return function(t){for(var n,r=[],o=e([],t.length,t),i=o.length;i--;)t[n=o[i]]&&(r[i]=t[n]);return r}}function ie(e,t,n){var r=e[n=n||"getAttribute"]&&e[n](t)||e[t];return 2===(r||"").nodeType?r.nodeValue:r}function ae(e){return d((function(t){return"FORM"===t.nodeName&&ie(t,"method")===e}))}function ue(t,n){return t.style[n]||e.getComputedStyle(t)[n]}function ce(e,t){return d((function(n){return(n.nodeName&&n.nodeName.toLowerCase())===t&&n.type===e}))}function se(e){return d((function(t){return("hidden"===ue(t,"visibility")||t.hidden)===e}))}for(t in n=ee.support={},ee.version="1.4.3",ee.expando=v,l=function(e){for(var t=[],n=0,r=e.length;n"]=d(!0,(function(e){return T.call(e.children.length&&e.children)})),t=P.test(g.compaireDocumentPosition),s=t||P.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode,o=e.compaireDocumentPosition;return n===r||!(!r||1!==r.nodeType||!(e.contains?e.contains(t):o&&o(t)))}:function(e,t){if(t)for(;t=t.parentNode;)if(e===t)return!0;return!1},g):g},w=e.document.createElement("canvas").getContext("2d"),n.getContext="canvas"in w,n.getComputed=P.test(e.getComputedStyle),ee.matches=function(e,t){return ee(e,null,null,t)},ee.contains=function(e,t){return(e.ownerDocument||e)!==g&&m(e),s(e,t)},ee.attr=function(e,t){(e.ownerDocument||e)!==g&&m(e);var r=o.attrHandle[t.toLowerCase()],i=r&&E.call(o.attrHandle,t.toLowerCase())?r(e):void 0;return void 0!==i?i:n.attributes||!x?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},ee.error=function(e){throw new Error("Syntax error, Unrecognized expression: "+e)},r=ee.unique=function(e){var t,n=0,r=e.length;for(t=l(e=e||[]),e.length=0,e.splice(0,r);n":!0,"+":!0,"~":!0,"<":!0,"?":!0},relative:{"+":{dir:"nextElementSibling",first:!0},"?":{dir:"previousElementSibling"},"~":{dir:"nextElementSibling"},"<":{dir:"previousElementSibling",first:!0}},filter:{TAG:te((function(e){return d((function(t){return"*"===e||t.nodeName.toLowerCase()===e.toLowerCase()}))})),CLASS:te((function(e){return d((function(t){var n;return(n=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+e+"("+$+"|$)"))&&n.test(ie(t,"className")||ie(t,"class")||"")}))})),ATTR:te((function(e,t,n){return d((function(r){var o=ee.attr(r,e)||r.hasAttribute(e)&&e||"";return null==o?"!="===t:t?(o+="","="===t?o===n:"!="===t?o!==n:"^="===t?n&&0===o.indexOf(n):"*="===t?n&&o.indexOf(n)>-1:"$="===t?n&&o.slice(-n.length)===n:"~="===t?(" "+o.replace(U," ")+" ").indexOf(n)>-1:"|="===t&&(o===n||o.slice(0,n.length+1)===n+"-")):!!o}))})),CHILD:te((function(e,t,r){var o=":"+e+"-"+t;if(!n.qsa){r&&(o+="("+r+")");var i=[];return d((function(e){return L.apply(i,e.parentElement.querySelectorAll(o)),[].indexOf.call(i,e)>-1}))}return p(o,r)})),PSEUDO:function(e,t){var n=o.pseudos[e]||o.setFilters[e]||o.attrHandle[e]||ee.error("Unsupport pseudo: Compilation failed your'"+e+"' is not supported.");return n[v]?n(t):n}},pseudos:{not:te((function(e){var t=ee.matches(e);return d((function(e){return C.call(t,e)>-1==!1}))})),has:te((function(e){return d((function(t){return ee(e,t).length>0}))})),filter:te((function(e){var t=ee.matches(e);return d((function(e){return C.call(t,e)>-1==!0}))})),theme:d((function(e){return"meta"===e.nodeName.toLowerCase()&&F.test(ie(e,"name"))})),contains:te((function(e){return d((function(t){return(t.textContent||i(t)).indexOf(e)>-1}))})),icontains:te((function(e){return d((function(t){return(t.textContent||t.innerText||i(t)||"").toLowerCase().indexOf((e+"").toLowerCase())>-1}))})),lang:te((function(e){return j.test(e||"")||ee.error("Unsupport Language: "+e),e=(e+"").toLowerCase(),d((function(t){do{var n;if(n=x?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}))})),target:d((function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id})),root:d((function(e){return e===h})),focus:d((function(e){return e===e.activeElement&&(!g.hasFocus||g.hasFocus())&&!!(e.type||e.href||~e.tabIndex)})),checked:d((function(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"input"===t&&e.checked||"option"===t&&!!e.selected})),selected:d((function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected})),empty:d((function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0})),disabled:re(!0),visible:se(!1),post:ae("post"),get:ae("get"),hidden:se(!0),enabled:re(!1),parent:function(e){return d((function(t){return-1===C.call(o.pseudos.empty(e),t)}))(e)},header:d((function(e){return X.test(e.nodeName)})),input:d((function(e){return H.test(e.nodeName)})),button:d((function(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"button"===t||"input"===t&&"button"===e.type})),text:d((function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null!=(t=e.getAttribute("type"))||"text"===t.toLowerCase())})),src:d((function(e){return e.src})),eq:te((function(e){return oe((function(t,n){return[e<0?e+n:e]}))})),first:oe((function(){return[0]})),last:oe((function(e,t){return[t-1]})),center:oe((function(e,t){var n=t%2,r=Math.floor(t/2);return[r,!!n&&r+n]})),odd:d((function(e,t){return t%2})),even:d((function(e,t){return(t+1)%2})),lt:te((function(e){return oe((function(t,n){for(e=+(e<0?e+n:e>n?n:e);--e>=0;)t.push(e);return t.reverse()}))})),gt:te((function(e){return oe((function(t,n){for(e=+(e<0?e+n:e>n?n:e);++e-1||ie(e,"tabIndex")>-1})),access:te((function(e){return d((function(t){var n=ie(t,"accessKey").slice(0,1).toLowerCase();if("a"===t.nodeName.toLowerCase())return e?n===e.toLowerCase():!!n}))})),inline:d((function(e){return _.inlineTag.test(e.nodeName)})),canonical:d((function(e){return"meta"===e.nodeName.toLowerCase()&&"canonical"===ie(e,"rel")})),robots:d((function(e){return"meta"===e.nodeName.toLowerCase()&&"robots"===ie(e,"name")}))}},o.pseudos.is=o.pseudos.filter,o.pseudos.nth=o.pseudos.eq,o.pseudos.ctx=o.pseudos.context,o.relative)o.combinators[t]=de(o.relative[t]);for(t in{submit:!0,reset:!0,menu:!0})o.pseudos[t]=ce(t,"button");for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0,search:!0,range:!0,url:!0})o.pseudos[t]=ce(t,"input");function le(){}function fe(e,t){for(var n,r=e||[],i=0,a=t&&o.find.TAG("*",t),u=a.length;i!=u&&null!=(n=a[i]);i++)n&&n.nodeType&&r.push(n);return r}function de(e){return d(!0,(function(t){if(e.first)return t[e.dir];for(var n=[];t=t[e.dir];)n.push(t);return n}))}d((function(e){o.attrHandle[e]=d((function(t){return ie(t,e,"hasAttribute")}))}))(R.concat("|"+k).match(/\w+/g)),le.prototype=o.filters=o.pseudos,o.setFilters=new le,p=ee.compile=function(e,t){return function(n){if(":first-child"===e||":first-of-type"===e)return ee.matches(":first",n);if(":last-child"===e||":last-of-type"===e)return ee.matches(":last",n);if(":only-child"===e){var r=[];return d((function(e){1===e.parentElement.children.length&&r.push(e)}))(n),r}if(":only-of-type"===e){r=[];return d((function(e){1===(o=ee.matches(e.nodeName.toLowerCase(),e.parentElement.children)).length&&r.push(e)}))(n),r}if(":nth-last-of-type"===e){r=[];return d((function(e){o=T.call(e.parentNode.children).reverse(),r.push(o[t])}))(n),r}if(":nth-child"===e){var o;r=[];return d((function(e){o=T.call(e.parentNode.children)[t-1],C.call(n,o)>-1&&r.push(o)}))(n),r}}},u=ee.tokenize=function(e){for(var t,n,r,i=[];e;){for(r in t=!1,(n=Y.exec(e))&&(t=n.shift(),i.push({value:t,type:n[0].replace(Z," ")}),e=e.slice(t.length)),o.filter)(n=_[r].exec(e))&&(t=n.shift(),i.push({type:r,value:t,matches:n,unique:n[0]}),e=e.slice(t.length));if(!t)break}return e.length?ee.error(e):i.slice(0)},c=ee.select=function(e,t,n,i){var a,c,s,l,f,d,p,m=0;for(n=n||[],f=(i=i||[]).length,e=(e+"").replace(O," ").trim().split(/\s*,\s*/);c=e[m++];){for(d=f&&i||[],f||fe(d,t||b),l=u(c),a=0;s=l[a++];)d=(p=Y.exec(c))?o.combinators[p[0]]([t]):o.combinators[s.type]?o.combinators[s.type](d):o.filter[s.type](s.matches[0],s.matches[1],s.matches[2]||s.matches[3]||s.matches[4])(d);L.apply(n,d)}return r(n)},ee.uniqueSort=function(e){return r(e.sort())},m();var pe=e.Snizzle;ee.noConflict=function(){return e.Snizzle===ee&&(e.Snizzle=pe),ee},"function"==typeof define&&define.amd?define((function(){return ee})):"object"==typeof module&&module.exports?module.exports=ee:e.Snizzle=ee}(window); +/** Snizzle is fast feature-rich CSS Selector Engine @version 1.4.1 Date: 13 January 2023 12:25 GMT+0530 */ +!function(e){var t,n,r,o,i,a,u,c,s,l,f,d,p,m,g,h,x,y,w,v="snizzle"+1*Date.now(),b=e.document,E={}.hasOwnProperty,N=[],C=N.indexOf,L=N.push,T=N.slice,A=N.concat,S=function(){m()},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped|muted",k="clip|color|cursor|direction|display|fill|filter|font|kerning|marker|mask|stroke|zoomandpan|xml:(?:lang|space|base)|clip-(?:path|rule)|lighting-color|points|d|viewbox|enable-background|fill-(?:opacity|rule)|flood-(?:color|opacity)|glyph-orientation-(?:horizontal|vertical)|image-rendering|stop-(?:color|opacity)|dominant-baseline|x1|x2|y1|y2|cx|cy|r|ry|stroke-(?:dasharray|dashoffset|linecap|linejoin|miterlimit|opacity|width)|text-rendering",$="[\\x20\\t\\r\\n\\f]",B="(?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",z="\\[[\\x20\\t\\r\\n\\f]*("+B+")(?:"+$+"*([*^$|!~]?=)"+$+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+B+"))|)"+$+"*\\]",q=$+"*\\b(\\)*)(\\/)\\b|((\\])\\/)"+$+"*",D="\\[[\\x20\\t\\r\\n\\f]*(?:(([\\w-]+)\\(\\@([\\w-]+),[\\x20\\t\\r\\n\\f]*['\"][\\x20\\t\\r\\n\\f]*(.*?)[\\x20\\t\\r\\n\\f]*['\"])\\)|((?:first|last|odd|even|name)\\(\\))|(\\@[\\w-]+[\\x20\\t\\r\\n\\f]*=[\\x20\\t\\r\\n\\f]*['\"]*(.*?)['\"]*)|(([\\w-]+)\\(\\@(.*?)\\))|(\\@[\\w-]+)|([\\w-]+\\(\\))[\\x20\\t\\r\\n\\f]*=['\"]*[\\x20\\t\\r\\n\\f]*(.*?)[\\x20\\t\\r\\n\\f]*['\"]*|([\\w-]+)\\([\\x20\\t\\r\\n\\f]*([\\w-]+\\(\\)),[\\x20\\t\\r\\n\\f]*['\"]*(.*?)['\"]*\\))[\\x20\\t\\r\\n\\f]*\\]",O=new RegExp("^[\\x20\\t\\r\\n\\f]*,[\\x20\\t\\r\\n\\f]*"),I=new RegExp("([\\w-]+)\\[[\\x20\\t\\r\\n\\f]*(\\d+)[\\x20\\t\\r\\n\\f]*\\]","g"),F=new RegExp("^(?:theme-color|apple-mobile-web-app-status-bar-style|msapplication-TileColor|msapplication-navbutton-color)$","i"),H=/^(?:input|select|textarea|button)/i,U=new RegExp($+"+","g"),j=new RegExp("^"+B+"$"),M=new RegExp("([\\w-]+)[\\x20\\t\\r\\n\\f]*\\b(\\)*)(\\/)\\b|((\\])\\/)[\\x20\\t\\r\\n\\f]*following-sibling::([\\w-]+)|"+D),P=/^[^{]+\{\s*\[native \w/,G=/^\/(?:|\/\*)+/,V=new RegExp(q,"g"),K=/\/\s*$/,Q=/HTML$/i,X=/^h[1-6]$/i,J=/^(none)\s*(0s)\s*(ease)\s*(0s).*(running)/,W=/^(?:#(\s*[\w-]+\s*)|(\w+)|\.([\w-]+))$/,Y=new RegExp("^[\\x20\\t\\r\\n\\f]*([>+~=<]|[\\x20\\t\\r\\n\\f])[\\x20\\t\\r\\n\\f]*"),Z=new RegExp("^[\\x20\\t\\r\\n\\f]+|((?:^|[^\\\\])(?:\\\\.)*)[\\x20\\t\\r\\n\\f]+$","g"),_={inlineTag:new RegExp("^(?:img|input|meta|area|keygen|base|link|br|hr|command|col|param|track|wbr|embed|source)$","i"),bool:new RegExp("^(?:"+R+")$","i"),ID:new RegExp("^#("+B+")"),CLASS:new RegExp("^\\.("+B+")"),TAG:new RegExp("^("+B+"|[*])"),ATTR:new RegExp("^"+z),PSEUDO:new RegExp("^:((?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)"),nstag:new RegExp("^(?:svg|g|defs|desc|symbol|use|image|switch|set|circle|ellipse|line|polyline|animatetransform|mpath|foreignobject|linegradient|radialgradient|stop|pattern|polygon|path|text|tspan|textpath|tref|marker|view|rect|animatemotion|font|clippath|mask|filter|cursor|hkern|vkern|(?:font-(face)(?:.*|src|uri|format|name)))$","i"),nsattr:new RegExp("^(?:"+k+")$"),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),needsContext:new RegExp("^[\\x20\\t\\r\\n\\f]*[>+~=<]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)","i")};function ee(e,t,n,r){var o,i,a,u,s=t&&t.ownerDocument,l=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==l&&9!==l&&11!==l)return g;if(!r&&(m(t),t=t||g,x&&11!==l&&(i=W.exec(e))))return(o=i[1])?((a=9===l?t.getElementById(o):s&&s.getElementById(o))&&n.push(a),n):(o=i[3],a=i[2]?t.getElementsByTagName(e):o&&t.getElementsByClassName(o),L.apply(n,a),n);if(e="/"===e?":root":e.replace(G,"").replace(I,"$1:nth-of-type($2)").replace(V,(function(e,t,n){return(arguments[4]||t)+" > "})),M.test(e)){u=new RegExp(D,"g");var f={"starts-with":"^=",contains:"*=","ends-with":"$="};e=e.replace(u,(function(e,t,n,r,o,i,a,u,c,s,l,d){return n&&r&&o?"["+r+f[n]+o+"]":c&&s&&l?":"+s+"(["+l+"])":i?":"+i:a&&u||d?"["+(a||d).replace("@","")+"]":void 0}))}return c(e.replace(Z,"$1"),t,n,r)}function te(e){return e[v]=!0,e}function ne(e){var t=g.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function re(e){return d((function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.disabled===e||t.disabled!==!e:t.disabled===e:"label"in t&&t.disabled===e}))}function oe(e){return function(t){for(var n,r=[],o=e([],t.length,t),i=o.length;i--;)t[n=o[i]]&&(r[i]=t[n]);return r}}function ie(e,t,n){var r=e[n=n||"getAttribute"]&&e[n](t)||e[t];return 2===(r||"").nodeType?r.nodeValue:r}function ae(e){return d((function(t){return"FORM"===t.nodeName&&ie(t,"method")===e}))}function ue(t,n){return t.style[n]||e.getComputedStyle(t)[n]}function ce(e,t){return d((function(n){return(n.nodeName&&n.nodeName.toLowerCase())===t&&n.type===e}))}function se(e){return d((function(t){return("hidden"===ue(t,"visibility")||t.hidden)===e}))}for(t in n=ee.support={},ee.version="1.5.0",ee.expando=v,l=function(e){for(var t=[],n=0,r=e.length;n"]=d(!0,(function(e){return T.call(e.children.length&&e.children)})),t=P.test(g.compaireDocumentPosition),s=t||P.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode,o=e.compaireDocumentPosition;return n===r||!(!r||1!==r.nodeType||!(e.contains?e.contains(t):o&&o(t)))}:function(e,t){if(t)for(;t=t.parentNode;)if(e===t)return!0;return!1},g):g},w=e.document.createElement("canvas").getContext("2d"),n.getContext="canvas"in w,n.getComputed=P.test(e.getComputedStyle),ee.matches=function(e,t){return ee(e,null,null,t)},ee.contains=function(e,t){return(e.ownerDocument||e)!==g&&m(e),s(e,t)},ee.attr=function(e,t){(e.ownerDocument||e)!==g&&m(e);var r=o.attrHandle[t.toLowerCase()],i=r&&E.call(o.attrHandle,t.toLowerCase())?r(e):void 0;return void 0!==i?i:n.attributes||!x?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},ee.error=function(e){throw new Error("Syntax error, Unrecognized expression: "+e)},r=ee.unique=function(e){var t,n=0,r=e.length;for(t=l(e=e||[]),e.length=0,e.splice(0,r);n":!0,"+":!0,"~":!0,"<":!0,"?":!0},relative:{"+":{dir:"nextElementSibling",first:!0},"?":{dir:"previousElementSibling"},"~":{dir:"nextElementSibling"},"<":{dir:"previousElementSibling",first:!0}},filter:{TAG:te((function(e){return d((function(t){return"*"===e||t.nodeName.toLowerCase()===e.toLowerCase()}))})),CLASS:te((function(e){return d((function(t){var n;return(n=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+e+"("+$+"|$)"))&&n.test(ie(t,"className")||ie(t,"class")||"")}))})),ATTR:te((function(e,t,n){return d((function(r){var o=ee.attr(r,e)||r.hasAttribute(e)&&e||"";return null==o?"!="===t:t?(o+="","="===t?o===n:"!="===t?o!==n:"^="===t?n&&0===o.indexOf(n):"*="===t?n&&o.indexOf(n)>-1:"$="===t?n&&o.slice(-n.length)===n:"~="===t?(" "+o.replace(U," ")+" ").indexOf(n)>-1:"|="===t&&(o===n||o.slice(0,n.length+1)===n+"-")):!!o}))})),CHILD:te((function(e,t,r){var o=":"+e+"-"+t;if(!n.qsa){r&&(o+="("+r+")");var i=[];return d((function(e){return L.apply(i,e.parentElement.querySelectorAll(o)),[].indexOf.call(i,e)>-1}))}return p(o,r)})),PSEUDO:function(e,t){var n=o.pseudos[e]||o.setFilters[e]||o.attrHandle[e]||ee.error("Unsupport pseudo: Compilation failed your'"+e+"' is not supported.");return n[v]?n(t):n}},pseudos:{not:te((function(e){var t=ee.matches(e);return d((function(e){return C.call(t,e)>-1==!1}))})),has:te((function(e){return d((function(t){return ee(e,t).length>0}))})),filter:te((function(e){var t=ee.matches(e);return d((function(e){return C.call(t,e)>-1==!0}))})),theme:d((function(e){return"meta"===e.nodeName.toLowerCase()&&F.test(ie(e,"name"))})),contains:te((function(e){return d((function(t){return(t.textContent||i(t)).indexOf(e)>-1}))})),icontains:te((function(e){return d((function(t){return(t.textContent||t.innerText||i(t)||"").toLowerCase().indexOf((e+"").toLowerCase())>-1}))})),lang:te((function(e){return j.test(e||"")||ee.error("Unsupport Language: "+e),e=(e+"").toLowerCase(),d((function(t){do{var n;if(n=x?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}))})),target:d((function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id})),root:d((function(e){return e===h})),focus:d((function(e){return e===e.activeElement&&(!g.hasFocus||g.hasFocus())&&!!(e.type||e.href||~e.tabIndex)})),checked:d((function(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"input"===t&&e.checked||"option"===t&&!!e.selected})),selected:d((function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected})),empty:d((function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0})),disabled:re(!0),visible:se(!1),post:ae("post"),get:ae("get"),hidden:se(!0),enabled:re(!1),parent:function(e){return d((function(t){return-1===C.call(o.pseudos.empty(e),t)}))(e)},header:d((function(e){return X.test(e.nodeName)})),input:d((function(e){return H.test(e.nodeName)})),button:d((function(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"button"===t||"input"===t&&"button"===e.type})),text:d((function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null!=(t=e.getAttribute("type"))||"text"===t.toLowerCase())})),src:d((function(e){return e.src})),eq:te((function(e){return oe((function(t,n){return[e<0?e+n:e]}))})),first:oe((function(){return[0]})),last:oe((function(e,t){return[t-1]})),center:oe((function(e,t){var n=t%2,r=Math.floor(t/2);return[r,!!n&&r+n]})),odd:d((function(e,t){return t%2})),even:d((function(e,t){return(t+1)%2})),lt:te((function(e){return oe((function(t,n){for(e=+(e<0?e+n:e>n?n:e);--e>=0;)t.push(e);return t.reverse()}))})),gt:te((function(e){return oe((function(t,n){for(e=+(e<0?e+n:e>n?n:e);++e-1||ie(e,"tabIndex")>-1})),access:te((function(e){return d((function(t){var n=ie(t,"accessKey").slice(0,1).toLowerCase();if("a"===t.nodeName.toLowerCase())return e?n===e.toLowerCase():!!n}))})),inline:d((function(e){return _.inlineTag.test(e.nodeName)})),canonical:d((function(e){return"meta"===e.nodeName.toLowerCase()&&"canonical"===ie(e,"rel")})),robots:d((function(e){return"meta"===e.nodeName.toLowerCase()&&"robots"===ie(e,"name")}))}},o.pseudos.is=o.pseudos.filter,o.pseudos.nth=o.pseudos.eq,o.pseudos.ctx=o.pseudos.context,o.relative)o.combinators[t]=de(o.relative[t]);for(t in{submit:!0,reset:!0,menu:!0})o.pseudos[t]=ce(t,"button");for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0,search:!0,range:!0,url:!0})o.pseudos[t]=ce(t,"input");function le(){}function fe(e,t){for(var n,r=e||[],i=0,a=t&&o.find.TAG("*",t),u=a.length;i!=u&&null!=(n=a[i]);i++)n&&n.nodeType&&r.push(n);return r}function de(e){return d(!0,(function(t){if(e.first)return t[e.dir];for(var n=[];t=t[e.dir];)n.push(t);return n}))}d((function(e){o.attrHandle[e]=d((function(t){return ie(t,e,"hasAttribute")}))}))(R.concat("|"+k).match(/\w+/g)),le.prototype=o.filters=o.pseudos,o.setFilters=new le,p=ee.compile=function(e,t){return function(n){if(":first-child"===e||":first-of-type"===e)return ee.matches(":first",n);if(":last-child"===e||":last-of-type"===e)return ee.matches(":last",n);if(":only-child"===e){var r=[];return d((function(e){1===e.parentElement.children.length&&r.push(e)}))(n),r}if(":only-of-type"===e){r=[];return d((function(e){1===(o=ee.matches(e.nodeName.toLowerCase(),e.parentElement.children)).length&&r.push(e)}))(n),r}if(":nth-last-of-type"===e){r=[];return d((function(e){o=T.call(e.parentNode.children).reverse(),r.push(o[t])}))(n),r}if(":nth-child"===e){var o;r=[];return d((function(e){o=T.call(e.parentNode.children)[t-1],C.call(n,o)>-1&&r.push(o)}))(n),r}}},u=ee.tokenize=function(e){for(var t,n,r,i=[];e;){for(r in t=!1,(n=Y.exec(e))&&(t=n.shift(),i.push({value:t,type:n[0].replace(Z," ")}),e=e.slice(t.length)),o.filter)(n=_[r].exec(e))&&(t=n.shift(),i.push({type:r,value:t,matches:n,unique:n[0]}),e=e.slice(t.length));if(!t)break}return e.length?ee.error(e):i.slice(0)},c=ee.select=function(e,t,n,i){var a,c,s,l,f,d,p,m=0;for(n=n||[],f=(i=i||[]).length,e=(e+"").replace(O," ").trim().split(/\s*,\s*/);c=e[m++];){for(d=f&&i||[],f||fe(d,t||b),l=u(c),a=0;s=l[a++];)d=(p=Y.exec(c))?o.combinators[p[0]]([t]):o.combinators[s.type]?o.combinators[s.type](d):o.filter[s.type](s.matches[0],s.matches[1],s.matches[2]||s.matches[3]||s.matches[4])(d);L.apply(n,d)}return r(n)},ee.uniqueSort=function(e){return r(e.sort())},m();var pe=e.Snizzle;ee.noConflict=function(){return e.Snizzle===ee&&(e.Snizzle=pe),ee},"function"==typeof define&&define.amd?define((function(){return ee})):"object"==typeof module&&module.exports?module.exports=ee:e.Snizzle=ee}(window); \ No newline at end of file diff --git a/dist/snizzle.js b/dist/snizzle.js index ca0d98d..dbfc964 100644 --- a/dist/snizzle.js +++ b/dist/snizzle.js @@ -1,9 +1,9 @@ /** - * Snizzle is a advance feature-rich CSS Selector Engine v1.4.3 + * Snizzle is a advance feature-rich CSS Selector Engine v1.5.0 * https://github.com/jqrony/snizzle * * @releases +7 releases - * @version 1.4.3 + * @version 1.5.0 * * Copyright OpenJS Foundation and other contributors * Released under the MIT license @@ -21,7 +21,7 @@ var i, support, unique, Expr, getText, isXML, tokenize, select, expando = "snizzle" + 1 * Date.now(), preferredDoc = window.document, - version = "1.4.3", + version = "1.5.0", // Instance methods hasOwn = ({}).hasOwnProperty, @@ -41,29 +41,11 @@ var i, support, unique, Expr, getText, isXML, tokenize, select, // Local document vars setDocument, document, docElem, documentIsHTML, - - // Regular expressions sources - // HTML Singleton TAGS with no closing TAG - nctags = "img|input|meta|area|keygen|base|link|br|hr|command|col|param|track|wbr|embed|" + - "source", - - nstags = "svg|g|defs|desc|symbol|use|image|switch|set|circle|ellipse|line|polyline|" + - "animatetransform|mpath|foreignobject|linegradient|radialgradient|stop|pattern|" + - "polygon|path|text|tspan|textpath|tref|marker|view|rect|animatemotion|font|" + - "clippath|mask|filter|cursor|hkern|vkern|(?:font-(face)(?:.*|src|uri|format|name))", - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + "ismap|loop|multiple|open|readonly|required|scoped|muted", themes = "theme-color|apple-mobile-web-app-status-bar-style|msapplication-TileColor|" + "msapplication-navbutton-color", - - nsattributes = "clip|color|cursor|direction|display|fill|filter|font|kerning|marker|" + - "mask|stroke|zoomandpan|xml:(?:lang|space|base)|clip-(?:path|rule)|lighting-color|" + - "points|d|viewbox|enable-background|fill-(?:opacity|rule)|flood-(?:color|opacity)|" + - "glyph-orientation-(?:horizontal|vertical)|image-rendering|stop-(?:color|opacity)|" + - "dominant-baseline|x1|x2|y1|y2|cx|cy|r|ry|" + - "stroke-(?:dasharray|dashoffset|linecap|linejoin|miterlimit|opacity|width)|text-rendering", whitespace = "[\\x20\\t\\r\\n\\f]", identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", @@ -109,15 +91,12 @@ var i, support, unique, Expr, getText, isXML, tokenize, select, rcombinators = new RegExp("^" + whitespace+ "*([>+~=<]|" +whitespace+ ")" + whitespace + "*"), rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), matchExpr = { - "inlineTag": new RegExp("^(?:" + nctags + ")$", "i"), "bool": new RegExp("^(?:" + booleans + ")$", "i"), "ID": new RegExp("^#(" + identifier + ")"), "CLASS": new RegExp("^\\.(" + identifier + ")"), "TAG": new RegExp("^(" + identifier + "|[*])"), "ATTR": new RegExp("^" + attributes), "PSEUDO": new RegExp("^" + pseudos), - "nstag": new RegExp("^(?:" + nstags + ")$", "i"), - "nsattr": new RegExp("^(?:" + nsattributes + ")$"), "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), @@ -1052,7 +1031,7 @@ access(function(attr) { Expr.attrHandle[attr]=access(function(elem) { return attrFilter(elem, attr, "hasAttribute"); }); -})(booleans.concat("|" + nsattributes).match(/\w+/g)); +})(booleans.match(/\w+/g)); /** * setFilters diff --git a/package.json b/package.json index bf998f3..b0727b9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "title": "Snizzle", "name": "snizzle", - "version": "1.4.3", + "version": "1.5.0", "description": "A pure-JavaScript fast, CSS selector engine program to be easily select DOM-Elements", "types": "dist/snizzle.js", "main": "dist/snizzle.js",