├── .eslintrc.yml ├── .gitattributes ├── .github └── workflows │ └── node.js.yml ├── .gitignore ├── .npmignore ├── LICENSE ├── Makefile ├── README.md ├── bin ├── cygwin1.dll ├── js.exe ├── js_linux ├── js_macos ├── jsl.exe ├── jsl_linux ├── jsl_macos ├── jsmin.exe ├── jsmin_linux ├── jsmin_macos └── os_list ├── bower.json ├── build ├── HEADER ├── VERSION ├── conf │ ├── jsl.conf │ └── jsl.default.conf ├── packer │ ├── base2.js │ └── packer.js └── scripts │ ├── nwjslint.sh │ ├── nwpacker.js │ ├── nwpackjs.sh │ └── nwtestjs.sh ├── dist └── lint.log ├── package.json ├── src ├── modules │ ├── nwsapi-jquery.js │ └── nwsapi-traversal.js └── nwsapi.js └── test ├── W3C-Selector-tests ├── W3C-Selector-tests-github.html └── W3C-Selector-tests-nwsapi.html ├── css3-compat ├── css3-compat.css ├── css3-compat.html └── css3-compat.js ├── css3-escape ├── test_escaped_identifiers.html └── test_nwsapi_escaped_identifiers.js ├── html5 ├── html5test.html └── negationtest.html ├── jquery ├── data │ └── iframe.html ├── jquery.html ├── qunit │ ├── testrunner.js │ └── testsuite.css └── unit │ └── selector.js ├── jsvm ├── env.js ├── load_test.html └── load_test.js ├── prototype ├── assets │ └── prototype.js ├── lib_assets │ ├── unittest.css │ └── unittest.js ├── nwsapi-proto-test.html ├── selector_engine_test.html ├── selector_test.html ├── test.css └── tests │ ├── nwsapi-test.js │ ├── selector_engine_test.js │ └── selector_test.js ├── quirks ├── test-class-attribute-quirks.html └── test-class-attribute-standard.html ├── scope ├── scope-01a.html ├── scope-01b.html ├── scope-02a.html ├── scope-02b.html ├── scope-03a.html ├── scope-03b.html ├── scope-04a.html ├── scope-04b.html └── scope-05a.js ├── scotch ├── assets │ └── style.css ├── scotch.js ├── test-browser.html ├── test-browser.js ├── test-cli.js ├── test.html └── test.js ├── slick ├── Configuration.js ├── Configuration.js.complete ├── Configuration.js.modular ├── Runner │ ├── Configuration_Example.js │ ├── Helpers │ │ ├── JSSpecToJasmine.js │ │ ├── Loader.js │ │ ├── RunnerOptions.js │ │ ├── Syn.js │ │ ├── jasmine-html.js │ │ └── simulateEvent.js │ ├── JSTD-Adapter │ │ ├── MIT.LICENSE │ │ ├── README.md │ │ ├── jsTestDriver.conf │ │ ├── server.sh │ │ ├── src-test │ │ │ └── tests.js │ │ ├── src │ │ │ └── JasmineAdapter.js │ │ └── test.sh │ ├── JSTestDriver │ │ ├── JSTestDriver.jar │ │ └── plugins │ │ │ └── coverage.jar │ ├── Jasmine-Node │ │ ├── LICENSE │ │ ├── README.md │ │ ├── lib │ │ │ └── jasmine │ │ │ │ ├── index.js │ │ │ │ └── jasmine.js │ │ ├── spec │ │ │ ├── SampleSpecs.js │ │ │ ├── TestSpec.js │ │ │ └── nested │ │ │ │ ├── NestedSpec.js │ │ │ │ └── uber-nested │ │ │ │ └── UberNestedSpec.js │ │ ├── specs.js │ │ └── specs.sh │ ├── Jasmine │ │ ├── jasmine.css │ │ └── jasmine.js │ ├── README.md │ ├── buildJSTDConfiguration.js │ ├── index.html │ ├── jsTestDriverServer.conf │ ├── reports │ │ └── README │ ├── runner.css │ ├── runner.html │ ├── runner.js │ ├── server │ ├── server.bat │ ├── test │ └── test.bat ├── assets │ ├── JSSpecHelpers.js │ ├── getgetter.js │ ├── ie.css │ ├── moobugger │ │ ├── bookmarklet.html │ │ ├── debugger-iframe.js │ │ ├── debugger.css │ │ ├── debugger.html │ │ ├── debugger.js │ │ ├── images │ │ │ ├── close.png │ │ │ ├── error.png │ │ │ ├── group-close.png │ │ │ ├── group-open.png │ │ │ ├── icon.png │ │ │ ├── info.png │ │ │ ├── lick.png │ │ │ ├── max.png │ │ │ ├── min.png │ │ │ ├── mootools.png │ │ │ ├── time.png │ │ │ └── warning.png │ │ ├── mootools.js │ │ └── test.html │ ├── screen.css │ ├── simple_request.js │ └── slickspec.css ├── bootstrap │ ├── moo12.slickspec.js │ ├── nwmatcher.slickspec.js │ ├── nwsapi.slickspec.js │ ├── sizzle.slickspec.js │ ├── slick.slickspec.js │ └── yui.slickspec.js ├── index.html ├── mocks │ ├── MooTools_Logo.svg │ ├── blank.html │ ├── data │ │ └── iframe.html │ ├── first-letter.gif │ ├── first-letter2.gif │ ├── html5-shim.html │ ├── initial-cap.png │ ├── query_test-dojo.html │ ├── query_test-google_closure.html │ ├── query_test-jquery.html │ ├── query_test-prototype.html │ ├── query_test-slick.html │ ├── query_test-yui.html │ ├── template-almost.html │ ├── template-chromeframe.html │ ├── template-ie7.html │ ├── template-quirks.html │ ├── template-standard.html │ ├── template-transitional.html │ ├── template.xhtml │ ├── template.xml │ ├── test-frame.html │ ├── test.css │ └── xml.xml ├── parent.html ├── quirks.html ├── select.html ├── setup.js ├── slickspec.html ├── specrunner_browser.html ├── specs │ ├── api.js │ ├── browser_bugs.js │ ├── dojo.js │ ├── engine_bugs.js │ ├── google_closure.js │ ├── html.js │ ├── html5.js │ ├── isxml.js │ ├── jquery.js │ ├── match.js │ ├── mock_template.js │ ├── parser.js │ ├── prototype.js │ ├── select_exhaustive.js │ ├── select_nth-child.js │ ├── syntax.js │ ├── unit.js │ ├── xml.js │ └── yui.js └── user-specs │ └── pseudos.html ├── speed ├── assets │ ├── LICENSE.txt │ └── benchmark.js ├── engines │ ├── nwmatcher-noqsa.js │ ├── nwmatcher.js │ ├── nwsapi.js │ └── qsa.js ├── example │ └── selectors.html ├── index.html ├── presets │ └── presets.js ├── speed.css └── speed.js ├── w3c-test.sh ├── w3c ├── css │ └── selectors │ │ ├── attribute-selectors │ │ └── attribute-case │ │ │ ├── resources │ │ │ ├── semantics-quirks.html │ │ │ ├── semantics-xml.xhtml │ │ │ ├── syntax-quirks.html │ │ │ └── syntax-xml.xhtml │ │ │ ├── semantics.html │ │ │ └── syntax.html │ │ ├── child-indexed-pseudo-class.html │ │ └── missing-right-token.html ├── dom │ └── nodes │ │ ├── Element-closest.html │ │ ├── Element-matches-init.js │ │ ├── Element-matches.html │ │ ├── Element-matches.js │ │ ├── ParentNode-querySelector-All-content.html │ │ ├── ParentNode-querySelector-All-content.xht │ │ ├── ParentNode-querySelector-All-xht.xht │ │ ├── ParentNode-querySelector-All.html │ │ ├── ParentNode-querySelector-All.js │ │ └── selectors.js ├── html │ ├── resources │ │ └── common.js │ ├── semantics │ │ ├── scripting-1 │ │ │ └── the-template-element │ │ │ │ └── resources │ │ │ │ ├── end-template-tag-in-body.html │ │ │ │ ├── end-template-tag-in-head.html │ │ │ │ ├── frameset-end-tag.html │ │ │ │ ├── head-template-contents-div-no-end-tag.html │ │ │ │ ├── head-template-contents-table-no-end-tag.html │ │ │ │ ├── html-start-tag.html │ │ │ │ ├── template-child-nodes-div.xhtml │ │ │ │ ├── template-child-nodes-nested.xhtml │ │ │ │ ├── template-contents-attribute.html │ │ │ │ ├── template-contents-body.html │ │ │ │ ├── template-contents-div-no-end-tag.html │ │ │ │ ├── template-contents-empty.html │ │ │ │ ├── template-contents-frameset.html │ │ │ │ ├── template-contents-head.html │ │ │ │ ├── template-contents-html.html │ │ │ │ ├── template-contents-nested.html │ │ │ │ ├── template-contents-table-no-end-tag.html │ │ │ │ ├── template-contents-text.html │ │ │ │ ├── template-contents.html │ │ │ │ ├── template-descendant-body.html │ │ │ │ ├── template-descendant-frameset.html │ │ │ │ ├── template-descendant-head.html │ │ │ │ └── two-templates.html │ │ └── selectors │ │ │ └── pseudo-classes │ │ │ ├── checked-001-manual.html │ │ │ ├── checked-type-change.html │ │ │ ├── checked.html │ │ │ ├── default.html │ │ │ ├── dir.html │ │ │ ├── dir01.html │ │ │ ├── disabled.html │ │ │ ├── enabled.html │ │ │ ├── focus-autofocus.html │ │ │ ├── focus-iframe.html │ │ │ ├── focus.html │ │ │ ├── indeterminate-radio.html │ │ │ ├── indeterminate-type-change.html │ │ │ ├── indeterminate.html │ │ │ ├── inrange-outofrange-type-change.html │ │ │ ├── inrange-outofrange.html │ │ │ ├── link.html │ │ │ ├── placeholder-shown-type-change.html │ │ │ ├── readwrite-readonly-type-change.html │ │ │ ├── readwrite-readonly.html │ │ │ ├── required-optional-hidden.html │ │ │ ├── required-optional.html │ │ │ ├── utils.js │ │ │ └── valid-invalid.html │ └── syntax │ │ ├── html-element-list.js │ │ └── parsing │ │ └── template │ │ ├── additions-to-foster-parenting │ │ ├── template-is-a-foster-parent-element.html │ │ └── template-is-not-a-foster-parent-element.html │ │ └── additions-to-the-in-body-insertion-mode │ │ ├── generating-of-implied-end-tags.html │ │ ├── ignore-body-token.html │ │ ├── ignore-frameset-token.html │ │ ├── ignore-head-token.html │ │ ├── ignore-html-token.html │ │ ├── start-tag-body.html │ │ ├── start-tag-html.html │ │ └── template-end-tag-without-start-one.html ├── index.html ├── jsdom │ ├── dom │ │ └── nodes │ │ │ ├── DocumentFragment-getElementById.html │ │ │ ├── Node-cloneNode-svg.html │ │ │ ├── ParentNode-querySelector-escapes.html │ │ │ ├── querySelector.html │ │ │ └── svg-template-querySelector.html │ ├── html │ │ └── start-tag-body.html │ ├── resources │ │ └── common.js │ └── svg │ │ ├── element-svg.html │ │ ├── element.html │ │ └── svganimatedstring.html └── resources │ ├── LICENSE │ ├── nwsapi.js │ ├── readme.md │ ├── testharness.css.headers │ ├── testharness.js │ ├── testharness.js.headers │ ├── testharness.js.orig │ ├── testharnessreport.js │ └── testharnessreport.js.headers ├── working-tests-index.html ├── wpt ├── favicon.ico ├── favicon.svg ├── index.html ├── router.php ├── testharness.js ├── wpt-helper.js └── wpt.sh └── xml ├── jsdom ├── svg-test.js └── xml-test.js ├── svg-test.html ├── xml-test.html └── xml-test2.html /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | env: 2 | amd: true 3 | browser: true 4 | commonjs: true 5 | 6 | rules: 7 | accessor-pairs: 2 8 | array-callback-return: 2 9 | block-scoped-var: 0 10 | class-methods-use-this: 2 11 | complexity: 0 12 | consistent-return: 2 13 | curly: 0 14 | default-case: 2 15 | dot-location: 2 16 | dot-notation: 0 17 | eqeqeq: 2 18 | for-direction: 2 19 | getter-return: 2 20 | guard-for-in: 0 21 | init-declarations: 0 22 | no-alert: 2 23 | no-await-in-loop: 2 24 | no-caller: 2 25 | no-case-declarations: 2 26 | no-catch-shadow: 2 27 | no-compare-neg-zero: 2 28 | no-cond-assign: 2 29 | no-console: 0 30 | no-constant-condition: 2 31 | no-control-regex: 0 32 | no-debugger: 2 33 | no-delete-var: 2 34 | no-div-regex: 2 35 | no-dupe-args: 2 36 | no-dupe-keys: 2 37 | no-duplicate-case: 2 38 | no-else-return: 2 39 | no-empty-character-class: 2 40 | no-empty-function: 2 41 | no-empty-pattern: 2 42 | no-empty: 2 43 | no-eq-null: 2 44 | no-eval: 2 45 | no-ex-assign: 2 46 | no-extend-native: 2 47 | no-extra-bind: 2 48 | no-extra-boolean-cast: 2 49 | no-extra-label: 2 50 | no-extra-parens: 2 51 | no-extra-semi: 2 52 | no-fallthrough: 2 53 | no-floating-decimal: 2 54 | no-func-assign: 2 55 | no-global-assign: 2 56 | no-implicit-coercion: 2 57 | no-implicit-globals: 2 58 | no-implied-eval: 2 59 | no-inner-declarations: 2 60 | no-invalid-regexp: 2 61 | no-invalid-this: 2 62 | no-irregular-whitespace: 2 63 | no-iterator: 2 64 | no-label-var: 2 65 | no-labels: 2 66 | no-lone-blocks: 2 67 | no-loop-func: 2 68 | no-magic-numbers: 0 69 | no-multi-spaces: 2 70 | no-multi-str: 2 71 | no-new-func: 0 72 | no-new-wrappers: 2 73 | no-new: 2 74 | no-obj-calls: 2 75 | no-octal-escape: 2 76 | no-octal: 2 77 | no-param-reassign: 0 78 | no-proto: 0 79 | no-prototype-builtins: 2 80 | no-redeclare: 2 81 | no-regex-spaces: 2 82 | no-restricted-globals: 2 83 | no-restricted-properties: 2 84 | no-return-assign: 2 85 | no-return-await: 2 86 | no-script-url: 2 87 | no-self-assign: 2 88 | no-self-compare: 2 89 | no-sequences: 2 90 | no-shadow-restricted-names: 2 91 | no-shadow: 0 92 | no-sparse-arrays: 2 93 | no-template-curly-in-string: 2 94 | no-throw-literal: 2 95 | no-undef-init: 2 96 | no-undef: 2 97 | no-undefined: 0 98 | no-unexpected-multiline: 2 99 | no-unmodified-loop-condition: 2 100 | no-unreachable: 2 101 | no-unsafe-finally: 2 102 | no-unsafe-negation: 2 103 | no-unused-expressions: 0 104 | no-unused-labels: 2 105 | no-unused-vars: 2 106 | no-use-before-define: 0 107 | no-useless-call: 2 108 | no-useless-concat: 2 109 | no-useless-escape: 2 110 | no-useless-return: 2 111 | no-void: 2 112 | no-warning-comments: 2 113 | no-with: 2 114 | prefer-promise-reject-errors: 2 115 | radix: 2 116 | require-await: 2 117 | strict: 0 118 | use-isnan: 2 119 | valid-jsdoc: 2 120 | valid-typeof: 2 121 | vars-on-top: 0 122 | wrap-iife: 0 123 | yoda: 2 124 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * linguist-vendored 2 | *.js linguist-vendored=false 3 | bin/* -crlf -diff -merge 4 | * eol=cr 5 | 6 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | name: nwsapi 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Checkout repository 17 | uses: actions/checkout@v2 18 | 19 | - name: Setup Node.js 20 | uses: actions/setup-node@v2 21 | with: 22 | node-version: '14' 23 | 24 | - name: Install dependencies 25 | run: npm install 26 | 27 | - name: Run tests 28 | run: npm testIs the NodeJS yaml configuration needed in my "nwsapi" repository ? 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | package-lock.json 3 | yarn.lock 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /* 2 | !dist/nwsapi.min.js 3 | !src/nwsapi.js 4 | !package.json 5 | !README.md 6 | !LICENSE 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007-2025 Diego Perini (http://www.iport.it/) 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | # NWSAPI distribution builder 5 | # 6 | # currently just a wrapper for: 7 | # 8 | # - nwjslint.sh (writes to lint.log) 9 | # - nwpackjs.sh (writes to dist.log) 10 | # 11 | # minifier by Dean Edwards 12 | # 13 | 14 | # getting path 15 | SOURCES=./ 16 | 17 | # resets default rules 18 | .SUFFIXES: 19 | 20 | # just in case they exists 21 | .PHONY: all clean dist lint 22 | 23 | # add a SILENT flag to stop 24 | # showing directories access 25 | ifeq ($(filter -s,$(MAKEFLAGS)),) 26 | MAKEFLAGS += -s 27 | endif 28 | 29 | # shell scripts directory 30 | SCRIPTS=${SOURCES}/build/scripts 31 | 32 | # default all stages 33 | all: 34 | @make clean ${SOURCES} 35 | @make lint ${SOURCES} 36 | @make dist ${SOURCES} 37 | @make test ${SOURCES} 38 | 39 | # clean stage 40 | clean: 41 | @rm -f dist/nwsapi.js 42 | @rm -f dist/nwsapi-min.js 43 | @rm -f dist/nwsapi-pac.js 44 | @rm -f dist/nwsapi-src.js 45 | @rm -f dist/nwsapi-zip.js 46 | @rm -f dist/lint.log 47 | 48 | # dist stage 49 | dist: 50 | @${SCRIPTS}/nwpackjs.sh ${SOURCES} 51 | 52 | # lint stage 53 | lint: 54 | @${SCRIPTS}/nwjslint.sh ${SOURCES} 55 | 56 | # test stage 57 | #test: 58 | # @${SCRIPTS}/nwtestjs.sh ${SOURCES} 59 | -------------------------------------------------------------------------------- /bin/cygwin1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/cygwin1.dll -------------------------------------------------------------------------------- /bin/js.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/js.exe -------------------------------------------------------------------------------- /bin/js_linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/js_linux -------------------------------------------------------------------------------- /bin/js_macos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/js_macos -------------------------------------------------------------------------------- /bin/jsl.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/jsl.exe -------------------------------------------------------------------------------- /bin/jsl_linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/jsl_linux -------------------------------------------------------------------------------- /bin/jsl_macos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/jsl_macos -------------------------------------------------------------------------------- /bin/jsmin.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/jsmin.exe -------------------------------------------------------------------------------- /bin/jsmin_linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/jsmin_linux -------------------------------------------------------------------------------- /bin/jsmin_macos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/bin/jsmin_macos -------------------------------------------------------------------------------- /bin/os_list: -------------------------------------------------------------------------------- 1 | Linux 2 | ================================ 3 | js_linux - Spidermonkey 1.8.0 4 | jsl_linux - Javascript Lint 5 | jsmin_linux - JS Minifier 6 | 7 | 8 | MacOSX 9 | ================================ 10 | js_macos - Spidermonkey 1.8.0 11 | jsl_macos - Javascript Lint 12 | jsmin_macos - JS Minifier 13 | 14 | 15 | Windows 16 | ================================ 17 | js.exe - Spidermonkey 1.8.0 18 | jsl.exe - Javascript Lint 19 | jsmin.exe - JS Minifier 20 | cygwin1.dll - DLL 21 | 22 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nwsapi", 3 | "version": "2.2.20", 4 | "homepage": "https://github.com/dperini/nwsapi", 5 | "authors": [ 6 | "Diego Perini " 7 | ], 8 | "description": "Fast CSS Selectors API Engine", 9 | "main": "src/nwsapi.js", 10 | "moduleType": [ 11 | "globals" 12 | ], 13 | "keywords": [ 14 | "javascript", 15 | "selector", 16 | "matcher", 17 | "library", 18 | "nwsapi" 19 | ], 20 | "license": "MIT", 21 | "ignore": [ 22 | "*/.*", 23 | "*.md", 24 | "bin", 25 | "test", 26 | "dist", 27 | "build", 28 | "Makefile", 29 | ".gitignore", 30 | ".npmignore", 31 | "package.json", 32 | ".gitattributes" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /build/HEADER: -------------------------------------------------------------------------------- 1 | /*! 2 | * NWSAPI 2.2.20 - Fast CSS Selectors API Engine 3 | * Copyright (c) 2007-2025 Diego Perini 4 | * See http://nwbox.com/license 5 | */ 6 | -------------------------------------------------------------------------------- /build/VERSION: -------------------------------------------------------------------------------- 1 | 2.2.20 2 | -------------------------------------------------------------------------------- /build/scripts/nwjslint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo -ne "NW: running javascript lint on sources" 4 | 5 | # set sources 6 | SOURCES=${1} 7 | if [ "${SOURCES}x" == 'x' ]; then 8 | pushd . &> /dev/null 9 | cd ..; SOURCES=`pwd` 10 | popd &> /dev/null 11 | fi 12 | 13 | # check platform 14 | PLATFORM=`uname -s` 15 | 16 | # set platform specifick executables 17 | if [ $PLATFORM == 'Darwin' ]; then 18 | JSL=bin/jsl_macos 19 | elif [ $PLATFORM == 'Linux' ]; then 20 | JSL=bin/jsl_linux 21 | elif [ $PLATFORM == 'Windows' ]; then 22 | JSL=bin/jsl.exe 23 | fi 24 | 25 | # save current working path 26 | pusdh . &> /dev/null 27 | 28 | # enter root path 29 | cd $SOURCES 30 | 31 | > $SOURCES/dist/lint.log 32 | 33 | for item in `find $SOURCES/src -type d` 34 | do { 35 | sources=`ls $item/*.js 2>/dev/null` 36 | for file in $sources 37 | do { 38 | $JSL -conf build/conf/jsl.conf -nologo -nofilelisting -nosummary -process $file >> $SOURCES/dist/lint.log 39 | echo -ne "." 40 | } done 41 | } done 42 | 43 | echo "" 44 | 45 | popd &> /dev/null 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /build/scripts/nwpacker.js: -------------------------------------------------------------------------------- 1 | /* 2 | * SpiderMonkey wrapper to compress Javascript source files, 3 | * uses Dean Edwards (http://dean.edwards.name/packer/) 4 | * 5 | * Author: Diego Perini 6 | * 7 | * Usage: fusecomp.js < input > output (uses stdin/stdout) 8 | * 9 | * Depends on correctly installed SpiderMonkey executable (js) 10 | * 11 | * Released under the Creative Commons license: 12 | * http://creativecommons.org/licenses/by/3.0/ 13 | */ 14 | 15 | // import Dean Edwards project files 16 | load("build/packer/base2.js"); 17 | load("build/packer/packer.js"); 18 | 19 | // read file from stdin 20 | function _readFile(from) { 21 | var outstr = '', line = ''; 22 | while ((line = readline()) != null) { 23 | outstr += line + '\x0a'; 24 | } 25 | return outstr; 26 | } 27 | 28 | // read from input pack and send to output 29 | (function minify() { 30 | // create new packer instance 31 | var packer = new Packer(); 32 | // shrink! 33 | print(packer.pack(_readFile(), 0, 1, 1)); 34 | })(); 35 | -------------------------------------------------------------------------------- /build/scripts/nwpackjs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo -ne "NW: building distribution from sources" 4 | 5 | # retrieve build infos 6 | VERSION=`cat ${SOURCES}build/VERSION` 7 | REVISION=1 8 | 9 | # set used variables 10 | BASEDIR=`pwd` 11 | PKGNAME="nwsapi" 12 | RELEASE=`date +%Y%m%d%H%M%S` 13 | 14 | # set sources 15 | SOURCES=${1} 16 | if [ "${SOURCES}x" == 'x' ]; then 17 | pushd . &> /dev/null 18 | cd ..; SOURCES=`pwd` 19 | popd &> /dev/null 20 | fi 21 | 22 | # check working platform 23 | PLATFORM=`uname -s` 24 | 25 | # set platform specifick executables 26 | if [ $PLATFORM == 'Darwin' ]; then 27 | JSMIN=bin/jsmin_macos 28 | JSVM=bin/js_macos 29 | elif [ $PLATFORM == 'Linux' ]; then 30 | JSMIN=bin/jsmin_linux 31 | JSVM=bin/js_linux 32 | elif [ $PLATFORM == 'Windows' ]; then 33 | JSMIN=bin/jsmin.exe 34 | JSVM=bin/js.exe 35 | fi 36 | 37 | pushd . &> /dev/null 38 | 39 | cd $SOURCES 40 | 41 | # ensure empty 42 | #> dist/$PKGNAME-src.js 43 | > dist/$PKGNAME.min.js 44 | 45 | cat build/HEADER >> dist/$PKGNAME.min.js 46 | 47 | # add selector engine to source file 48 | #cat src/nwsapi.js >> dist/$PKGNAME-src.js 49 | 50 | # add selector engine to minified file 51 | cat src/nwsapi.js | $JSMIN | tr -d "\n" >> dist/$PKGNAME.min.js 52 | echo >> dist/$PKGNAME.min.js 53 | 54 | # minification of variables and privates 55 | echo "" 56 | echo -ne "NW: starting minification, takes time please wait, " 57 | #$JSVM build/scripts/nwpacker.js < dist/nwsapi-src.js >> dist/nwsapi-pac.js 58 | echo -ne "complete..." 59 | echo "" 60 | 61 | # build a compressed version of the minified file 62 | #gzip -c -n9 dist/$PKGNAME-pac.js > dist/$PKGNAME-zip.js 63 | 64 | # build a versioned file name of the minified file 65 | #cp dist/$PKGNAME-pac.js dist/$PKGNAME-$RELEASE.js 66 | 67 | # now copy packed file to the real nwsapi.js 68 | #cp dist/nwsapi-pac.js dist/nwsapi.js 69 | 70 | popd &> /dev/null 71 | 72 | exit 0 73 | -------------------------------------------------------------------------------- /build/scripts/nwtestjs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo -ne "NW: VM loading test, building test units..." 4 | 5 | # retrieve build infos 6 | VERSION=`cat ${SOURCES}build/VERSION` 7 | REVISION=1 8 | 9 | # set used variables 10 | BASEDIR=`pwd` 11 | PKGNAME="nwsapi" 12 | RELEASE=`date +%Y%m%d%H%M%S` 13 | 14 | # set source 15 | SOURCES=${1} 16 | if [ "${SOURCES}x" == 'x' ]; then 17 | pushd . &> /dev/null 18 | cd ..; SOURCES=`pwd` 19 | popd &> /dev/null 20 | fi 21 | 22 | # check platform 23 | PLATFORM=`uname -s` 24 | 25 | if [ $PLATFORM == 'Darwin' ]; then 26 | JS=bin/js_macos 27 | elif [ $PLATFORM == 'Linux' ]; then 28 | JS=bin/js_linux 29 | elif [ $PLATFORM == 'Windows' ]; then 30 | JS=bin/js.exe 31 | fi 32 | 33 | pusdh . &> /dev/null 34 | 35 | $JS test/jsvm/load_test.js < test/jsvm/load_test.html 36 | 37 | if [ $? == '0' ]; then 38 | echo 'PASSED' 39 | elif [ $? != '0' ]; then 40 | echo 'FAILED' 41 | fi 42 | 43 | popd &> /dev/null 44 | 45 | exit 0 46 | -------------------------------------------------------------------------------- /dist/lint.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/dist/lint.log -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nwsapi", 3 | "version": "2.2.20", 4 | "description": "Fast CSS Selectors API Engine", 5 | "homepage": "https://javascript.nwbox.com/nwsapi/", 6 | "main": "./src/nwsapi", 7 | "keywords": [ 8 | "css", 9 | "css3", 10 | "css4", 11 | "matcher", 12 | "selector" 13 | ], 14 | "licenses": [ 15 | { 16 | "type": "MIT", 17 | "url": "https://javascript.nwbox.com/nwsapi/MIT-LICENSE" 18 | } 19 | ], 20 | "license": "MIT", 21 | "author": { 22 | "name": "Diego Perini", 23 | "email": "diego.perini@gmail.com", 24 | "web": "https://www.iport.it/" 25 | }, 26 | "maintainers": [ 27 | { 28 | "name": "Diego Perini", 29 | "email": "diego.perini@gmail.com", 30 | "web": "https://www.iport.it/" 31 | } 32 | ], 33 | "bugs": { 34 | "url": "https://github.com/dperini/nwsapi/issues" 35 | }, 36 | "repository": { 37 | "type": "git", 38 | "url": "git://github.com/dperini/nwsapi.git" 39 | }, 40 | "scripts": { 41 | "lint": "eslint ./src/nwsapi.js" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/css3-escape/test_escaped_identifiers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NWSAPI test for escaped identifiers 6 | 7 | 8 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/html5/html5test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NWSAPI HTML5 elements selection test 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 |

NWSAPI HTML5 elements selection test

20 | 21 |

Usual nonsense content...

22 | 23 |

24 | IBA 25 | Located at 116 Messina Avenue, London NW6 4LD 26 | UK 27 |

28 | 29 |
30 |
    31 |
  • First
  • 32 |
  • Second
  • 33 |
  • Last
  • 34 |
35 |
36 | 37 |
38 | 39 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /test/jquery/data/iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | iframe 4 | 5 | 6 |
span text
7 | 8 | 9 | -------------------------------------------------------------------------------- /test/jquery/qunit/testsuite.css: -------------------------------------------------------------------------------- 1 | body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 } 2 | body {font-size: 10pt; } 3 | h1 { padding: 15px; font-size: large; background-color: #06b; color: white; } 4 | h1 a { color: white; } 5 | h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal } 6 | 7 | .pass { color: green; } 8 | .fail { color: red; } 9 | p.result { margin-left: 1em; } 10 | 11 | #banner { height: 2em; border-bottom: 1px solid white; } 12 | h2.pass { background-color: green; } 13 | h2.fail { background-color: red; } 14 | 15 | ol#tests > li > strong { cursor:pointer; } 16 | 17 | div#fx-tests h4 { 18 | background: red; 19 | } 20 | 21 | div#fx-tests h4.pass { 22 | background: green; 23 | } 24 | 25 | div#fx-tests div.box { 26 | background: red url(data/cow.jpg) no-repeat; 27 | overflow: hidden; 28 | border: 2px solid #000; 29 | } 30 | 31 | div#fx-tests div.overflow { 32 | overflow: visible; 33 | } 34 | 35 | div.inline { 36 | display: inline; 37 | } 38 | 39 | div.autoheight { 40 | height: auto; 41 | } 42 | 43 | div.autowidth { 44 | width: auto; 45 | } 46 | 47 | div.autoopacity { 48 | opacity: inherit; 49 | } 50 | 51 | div.largewidth { 52 | width: 100px; 53 | } 54 | 55 | div.largeheight { 56 | height: 100px; 57 | } 58 | 59 | div.largeopacity { 60 | _filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100); 61 | } 62 | 63 | div.medwidth { 64 | width: 50px; 65 | } 66 | 67 | div.medheight { 68 | height: 50px; 69 | } 70 | 71 | div.medopacity { 72 | opacity: 0.5; 73 | _filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50); 74 | } 75 | 76 | div.nowidth { 77 | width: 0px; 78 | } 79 | 80 | div.noheight { 81 | height: 0px; 82 | } 83 | 84 | div.noopacity { 85 | opacity: 0; 86 | _filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); 87 | } 88 | 89 | div.hidden { 90 | display: none; 91 | } 92 | 93 | div#fx-tests div.widewidth { 94 | background-repeat: repeat-x; 95 | } 96 | 97 | div#fx-tests div.wideheight { 98 | background-repeat: repeat-y; 99 | } 100 | 101 | div#fx-tests div.widewidth.wideheight { 102 | background-repeat: repeat; 103 | } 104 | 105 | div#fx-tests div.noback { 106 | background-image: none; 107 | } 108 | 109 | div.chain, div.chain div { width: 100px; height: 20px; position: relative; float: left; } 110 | div.chain div { position: absolute; top: 0px; left: 0px; } 111 | 112 | div.chain.test { background: red; } 113 | div.chain.test div { background: green; } 114 | 115 | div.chain.out { background: green; } 116 | div.chain.out div { background: red; display: none; } 117 | 118 | div#show-tests * { display: none; } -------------------------------------------------------------------------------- /test/jsvm/load_test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | NWSAPI: SpiderMonkey/V8 Selectors TEST 4 | 5 | 6 | 7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/jsvm/load_test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * SpiderMonkey/V8 wrapper to test NWSAPI selector engine 3 | * 4 | * Author: Diego Perini 5 | * 6 | * Usage: load_test.js < input > output (uses stdin/stdout) 7 | * 8 | * Depends on correctly installed SpiderMonkey executable (js) 9 | * 10 | * Released under the Creative Commons license: 11 | * http://creativecommons.org/licenses/by/3.0/ 12 | */ 13 | 14 | // import Chris Tatcher env.js 15 | // since a DOM layer is needed 16 | load("test/jsvm/env.js"); 17 | load("dist/nwsapi.js"); 18 | 19 | // read file from stdin using SM or V8 style 20 | var _readFile = typeof this.read == 'function' ? 21 | function() { 22 | return read('/dev/stdin'); 23 | } : typeof this.readline == 'function' ? 24 | function() { 25 | var outstr = '', line = ''; 26 | while ((line = readline()) != null) { 27 | outstr += line + '\x0a'; 28 | } 29 | return outstr; 30 | } : 31 | function() { 32 | return ''; 33 | }; 34 | 35 | // read from standard input output to document 36 | (function(global) { 37 | 38 | var doc = global.document, results; 39 | 40 | doc.open('text/html', 'replace'); 41 | doc.write(_readFile()); 42 | doc.close(); 43 | 44 | print(); 45 | 46 | print('\nSelection Test - negation/emptiness "#test1 div:not(:empty)"\n'); 47 | 48 | results = NW.Dom.select('#test1 div:not(:empty)', doc, 49 | function(element) { 50 | print(element.nodeName); 51 | }); 52 | 53 | print('\n' + results.length + ' elements found.'); 54 | 55 | print('\nSelection Test - structural pseudos "#test1 div:nth-child(even):empty"\n'); 56 | 57 | results = NW.Dom.select('#test1 div:nth-child(even):empty', doc, 58 | function(element) { 59 | print(element.nodeName); 60 | }); 61 | 62 | print('\n' + results.length + ' elements found.'); 63 | 64 | print(); 65 | 66 | })(this); 67 | -------------------------------------------------------------------------------- /test/prototype/lib_assets/unittest.css: -------------------------------------------------------------------------------- 1 | body, div, p, h1, h2, h3, ul, ol, span, a, table, td, form, img, li { 2 | font-family: sans-serif; 3 | } 4 | 5 | body { 6 | font-size:0.8em; 7 | } 8 | 9 | #log { 10 | padding-bottom: 1em; 11 | border-bottom: 2px solid #000; 12 | margin-bottom: 2em; 13 | } 14 | 15 | .logsummary { 16 | margin-top: 1em; 17 | margin-bottom: 1em; 18 | padding: 1ex; 19 | border: 1px solid #000; 20 | font-weight: bold; 21 | } 22 | 23 | .logtable { 24 | width:100%; 25 | border-collapse: collapse; 26 | border: 1px dotted #666; 27 | } 28 | 29 | .logtable td, .logtable th { 30 | text-align: left; 31 | padding: 3px 8px; 32 | border: 1px dotted #666; 33 | } 34 | 35 | .logtable .passed { 36 | background-color: #cfc; 37 | } 38 | 39 | .logtable .failed, .logtable .error { 40 | background-color: #fcc; 41 | } 42 | 43 | .logtable td div.action_buttons { 44 | display: inline; 45 | } 46 | 47 | .logtable td div.action_buttons input { 48 | margin: 0 5px; 49 | font-size: 10px; 50 | } -------------------------------------------------------------------------------- /test/prototype/selector_engine_test.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | Unit test file | Selector Engine | default template | 2010-03-04 16:13 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 |
24 |
25 |
26 | 27 | 28 | 31 | -------------------------------------------------------------------------------- /test/prototype/test.css: -------------------------------------------------------------------------------- 1 | body, div, p, h1, h2, h3, ul, ol, span, a, table, td, form, img, li { 2 | font-family: sans-serif; 3 | } 4 | 5 | body { 6 | font-size:0.8em; 7 | } 8 | 9 | #log { 10 | padding-bottom: 1em; 11 | border-bottom: 2px solid #000; 12 | margin-bottom: 2em; 13 | } 14 | 15 | .logsummary { 16 | margin-top: 1em; 17 | margin-bottom: 1em; 18 | padding: 1ex; 19 | border: 1px solid #000; 20 | font-weight: bold; 21 | } 22 | 23 | .logtable { 24 | width:100%; 25 | border-collapse: collapse; 26 | border: 1px dotted #666; 27 | } 28 | 29 | .logtable td, .logtable th { 30 | text-align: left; 31 | padding: 3px 8px; 32 | border: 1px dotted #666; 33 | } 34 | 35 | .logtable .passed { 36 | background-color: #cfc; 37 | } 38 | 39 | .logtable .failed, .logtable .error { 40 | background-color: #fcc; 41 | } 42 | 43 | .logtable td div.action_buttons { 44 | display: inline; 45 | } 46 | 47 | .logtable td div.action_buttons input { 48 | margin: 0 5px; 49 | font-size: 10px; 50 | } -------------------------------------------------------------------------------- /test/prototype/tests/nwsapi-test.js: -------------------------------------------------------------------------------- 1 | (function(global) { 2 | 3 | var param, select; 4 | 5 | getQueryParam = 6 | function(key, defaultValue) { 7 | var pattern = new RegExp('[?&]' + key + '=([^&]+)'); 8 | return (global.location.href.match(pattern) || [0, defaultValue])[1]; 9 | }, 10 | 11 | refresh = 12 | function() { 13 | var loc = global.location; 14 | loc.replace(loc.protocol + '//' + loc.hostname + loc.pathname + 15 | '?engine=' + select.options[select.selectedIndex].text); 16 | }, 17 | 18 | change = 19 | function(options, value) { 20 | var i = -1, option; 21 | while ((option = options[++i])) { 22 | if (option.text == value) { 23 | options[0].parentNode.selectedIndex = i; 24 | break; 25 | } 26 | } 27 | }; 28 | 29 | global.$$ = 30 | function $$() { 31 | var context, args = $A(arguments); 32 | if (typeof args[args.length - 1] != 'string') { 33 | context = args.pop(); 34 | } 35 | return (param == 'NWSAPI') ? 36 | NW.Dom.select(args.join(', '), context) : 37 | Prototype.Selector.select(args.join(', '), context); 38 | }; 39 | 40 | global.onload = 41 | function() { 42 | var d = document; 43 | select = d.createElement('select'); 44 | select.appendChild(d.createElement('option')).appendChild(d.createTextNode('NWSAPI')); 45 | select.appendChild(d.createElement('option')).appendChild(d.createTextNode('Sizzle')); 46 | d.body.insertBefore(select, d.body.firstChild.nextSibling); 47 | d.body.insertBefore(d.createElement('b'), d.body.firstChild). 48 | appendChild(d.createTextNode('Choose selector engine\xa0')); 49 | param = getQueryParam('engine', 'NWSAPI'); 50 | change(select.options, param); 51 | select.onchange = refresh; 52 | }; 53 | 54 | })(this); 55 | -------------------------------------------------------------------------------- /test/prototype/tests/selector_engine_test.js: -------------------------------------------------------------------------------- 1 | /* 2 |
3 |
4 |
5 |
6 | */ 7 | 8 | new Test.Unit.Runner({ 9 | testEngine: function() { 10 | this.assert(Prototype.Selector.engine); 11 | }, 12 | 13 | testSelect: function() { 14 | var elements = Prototype.Selector.select('.test_class'); 15 | 16 | this.assert(Object.isArray(elements)); 17 | this.assertEqual(2, elements.length); 18 | this.assertEqual('test_div_parent', elements[0].id); 19 | this.assertEqual('test_div_child', elements[1].id); 20 | }, 21 | 22 | testSelectWithContext: function() { 23 | var elements = Prototype.Selector.select('.test_class', $('test_div_parent')); 24 | 25 | this.assert(Object.isArray(elements)); 26 | this.assertEqual(1, elements.length); 27 | this.assertEqual('test_div_child', elements[0].id); 28 | }, 29 | 30 | testSelectWithEmptyResult: function() { 31 | var elements = Prototype.Selector.select('.non_existent'); 32 | 33 | this.assert(Object.isArray(elements)); 34 | this.assertEqual(0, elements.length); 35 | }, 36 | 37 | testMatch: function() { 38 | var element = $('test_div_parent'); 39 | 40 | this.assertEqual(true, Prototype.Selector.match(element, '.test_class')); 41 | this.assertEqual(false, Prototype.Selector.match(element, '.non_existent')); 42 | }, 43 | 44 | testFind: function() { 45 | var elements = document.getElementsByTagName('*'), 46 | expression = '.test_class'; 47 | this.assertEqual('test_div_parent', Prototype.Selector.find(elements, expression).id); 48 | this.assertEqual('test_div_child', Prototype.Selector.find(elements, expression, 1).id); 49 | } 50 | }); -------------------------------------------------------------------------------- /test/quirks/test-class-attribute-quirks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NWSAPI HTML5 elements selection test 5 | 6 | 7 | 12 | 13 | 14 | 15 |

NWSAPI: test class attribute in Quirks Mode

16 | 17 |

Using NWSAPI select method looking for "[class~=foobar]" selector

18 | 19 |
20 |
Lower case classname foobar
21 |
Mixed case classname fooBar
22 |
Upper case classname FOOBAR
23 |
24 | 25 |

Using querySelectorAll method looking for "[class~=foobar]" selector

26 | 27 |
28 |
Lower case classname foobar
29 |
Mixed case classname fooBar
30 |
Upper case classname FOOBAR
31 |
32 | 33 |
34 | 35 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /test/quirks/test-class-attribute-standard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NWSAPI HTML5 elements selection test 6 | 7 | 8 | 13 | 14 | 15 | 16 |

NWSAPI: test class attribute in Standard Mode

17 | 18 |

Using NWSAPI select method looking for "[class~=foobar]" selector

19 | 20 |
21 |
Lower case classname foobar
22 |
Mixed case classname fooBar
23 |
Upper case classname FOOBAR
24 |
25 | 26 |

Using querySelectorAll method looking for "[class~=foobar]" selector

27 | 28 |
29 |
Lower case classname foobar
30 |
Mixed case classname fooBar
31 |
Upper case classname FOOBAR
32 |
33 | 34 |
35 | 36 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /test/scope/scope-01a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NWMatcher Scope Test 01 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
  • abc
  • 12 |
  • def
  • 13 |
  • efg
  • 14 |
15 | 16 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /test/scope/scope-01b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NWMatcher Scope Test 01 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
  • abc
  • 12 |
  • def
  • 13 |
  • efg
  • 14 |
15 | 16 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/scope/scope-02a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NWMatcher Test 5 | 6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /test/scope/scope-02b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NWMatcher Test 5 | 6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /test/scope/scope-03a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NWMatcher Test 5 | 6 | 7 | 8 | 9 |
10 |

11 | hello 12 |

13 |
14 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /test/scope/scope-03b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NWMatcher Test 5 | 6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /test/scope/scope-04a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test nwsapi 5 | 6 | 7 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | > 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/scope/scope-04b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 |
12 |
13 |
14 |
15 |
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /test/scope/scope-05a.js: -------------------------------------------------------------------------------- 1 | const { JSDOM } = require('./jsdom'); 2 | const document = new JSDOM(` 3 | 4 | 5 | JSDOM & NWSAPI (Template_01) 6 | 7 | 8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | 17 | 18 | `); 19 | 20 | const View = document.window; 21 | const Dom = require('../../src/nwsapi.js')(View); 22 | 23 | //(global.document.window); 24 | 25 | console.log(Dom); 26 | 27 | -------------------------------------------------------------------------------- /test/scotch/assets/style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | margin-top: 0; 3 | padding: 0; 4 | background-color: #f0f0f0; 5 | font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, sans-serif; 6 | font-size: 13px; 7 | color: #333; 8 | } 9 | div#container{ 10 | margin: 0 auto; 11 | background-color: white; 12 | border: 3px solid #aaa; 13 | border-top: none; 14 | padding: 25px; 15 | width: 75%; 16 | } 17 | div.log{ 18 | padding: 5px 5px 15px; 19 | margin-bottom: 15px; 20 | border-bottom: 2px solid #000; 21 | } 22 | div.log h1{ 23 | margin: 5px 0 10px; 24 | font-size: 28px; 25 | color: #800; 26 | } 27 | div.log div.logsummary{ 28 | margin: 5px 0 10px; 29 | padding: 7px; 30 | border: 1px solid #000; 31 | font-weight: bold; 32 | } 33 | div.log table.logtable{ 34 | width: 100%; 35 | border-collapse: collapse; 36 | border: 1px dotted #666; 37 | } 38 | div.log table.logtable td, div.log table.logtable th{ 39 | text-align: left; 40 | padding: 3px 8px; 41 | border: 1px dotted #666; 42 | } 43 | div.log table.logtable tr.passed{ 44 | background-color: #cfc; 45 | } 46 | div.log table.logtable tr.failed, div.log table.logtable tr.critical{ 47 | background-color: #fcc; 48 | } 49 | div.log table.logtable tr.warning{ 50 | background-color: #ff8; 51 | } 52 | -------------------------------------------------------------------------------- /test/scotch/test-browser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Scotch Unit Tests (Browser) 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /test/slick/Configuration.js: -------------------------------------------------------------------------------- 1 | (function(context){ 2 | 3 | var Configuration = context.Configuration = {}; 4 | 5 | Configuration.name = 'NWSAPI'; 6 | 7 | Configuration.presets = { 8 | 'nwsapi': { 9 | sets: ['specs'], 10 | source: ['helpers', 'nwsapi'] 11 | } 12 | }; 13 | 14 | Configuration.defaultPresets = { 15 | browser: 'nwsapi', 16 | jstd: 'nwsapi' 17 | }; 18 | 19 | Configuration.sets = { 20 | 'specs': { 21 | path: 'specs/', 22 | files: [ 23 | 'unit', 'syntax', 'engine_bugs', 'html', 'html5', 24 | 'select_nth-child', 'select_exhaustive', 'mock_template', 25 | 'isxml', 'xml', 26 | 'match', 27 | 'google_closure', 'prototype', 'jquery', 'dojo', 'yui' 28 | ] 29 | } 30 | 31 | }; 32 | 33 | Configuration.source = { 34 | 'helpers': { 35 | path: '', 36 | files: [ 37 | 'assets/simple_request', 38 | 'assets/JSSpecHelpers', 39 | 'bootstrap/nwsapi.slickspec', 40 | 'setup' 41 | ] 42 | }, 43 | 44 | 'nwsapi': { 45 | path: '../../src/', 46 | files: [ 47 | 'nwsapi', 48 | // 'modules/nwsapi-cache', 49 | // 'modules/nwsapi-shortcuts' 50 | ] 51 | } 52 | }; 53 | 54 | })(typeof exports != 'undefined' ? exports : this); 55 | -------------------------------------------------------------------------------- /test/slick/Configuration.js.complete: -------------------------------------------------------------------------------- 1 | (function(context){ 2 | 3 | var Configuration = context.Configuration = {}; 4 | 5 | Configuration.name = 'NWSAPI'; 6 | 7 | Configuration.presets = { 8 | 'nwsapi': { 9 | sets: ['specs'], 10 | source: ['helpers', 'nwsapi'] 11 | } 12 | }; 13 | 14 | Configuration.defaultPresets = { 15 | browser: 'nwsapi', 16 | jstd: 'nwsapi' 17 | }; 18 | 19 | Configuration.sets = { 20 | 'specs': { 21 | path: 'specs/', 22 | files: [ 23 | 'unit', 'syntax', 'engine_bugs', 'html', 'html5', 24 | 'select_nth-child', 'select_exhaustive', 'mock_template', 25 | 'isxml', 'xml', 26 | 'match', 27 | 'google_closure', 'prototype', 'jquery', 'dojo', 'yui' 28 | ] 29 | } 30 | 31 | }; 32 | 33 | Configuration.source = { 34 | 'helpers': { 35 | path: '', 36 | files: [ 37 | 'assets/simple_request', 38 | 'assets/JSSpecHelpers', 39 | 'bootstrap/nwsapi.slickspec', 40 | 'setup' 41 | ] 42 | }, 43 | 44 | 'nwsapi': { 45 | path: '../../src/', 46 | files: [ 47 | 'nwsapi', 48 | 'modules/nwsapi-cache', 49 | 'modules/nwsapi-shortcuts' 50 | ] 51 | } 52 | }; 53 | 54 | })(typeof exports != 'undefined' ? exports : this); 55 | -------------------------------------------------------------------------------- /test/slick/Configuration.js.modular: -------------------------------------------------------------------------------- 1 | (function(context){ 2 | 3 | var Configuration = context.Configuration = {}; 4 | 5 | Configuration.name = 'NWSAPI'; 6 | 7 | Configuration.presets = { 8 | 'nwsapi': { 9 | sets: ['specs'], 10 | source: ['helpers', 'nwsapi'] 11 | } 12 | }; 13 | 14 | Configuration.defaultPresets = { 15 | browser: 'nwsapi', 16 | jstd: 'nwsapi' 17 | }; 18 | 19 | Configuration.sets = { 20 | 'specs': { 21 | path: 'specs/', 22 | files: [ 23 | 'unit', 'syntax', 'engine_bugs', 'html', 'html5', 24 | 'select_nth-child', 'select_exhaustive', 'mock_template', 25 | 'isxml', 'xml', 26 | 'match', 27 | 'google_closure', 'prototype', 'jquery', 'dojo', 'yui' 28 | ] 29 | } 30 | 31 | }; 32 | 33 | Configuration.source = { 34 | 'helpers': { 35 | path: '', 36 | files: [ 37 | 'assets/simple_request', 38 | 'assets/JSSpecHelpers', 39 | 'bootstrap/nwsapi.slickspec', 40 | 'setup' 41 | ] 42 | }, 43 | 44 | 'nwsapi': { 45 | path: '../../src/', 46 | files: [ 47 | 'nwsapi-base', 48 | 'modules/nwsapi-cache', 49 | 'modules/nwsapi-pseudos', 50 | 'modules/nwsapi-shortcuts' 51 | ] 52 | } 53 | }; 54 | 55 | })(typeof exports != 'undefined' ? exports : this); 56 | -------------------------------------------------------------------------------- /test/slick/Runner/Configuration_Example.js: -------------------------------------------------------------------------------- 1 | // Put this file in the parent directory of the runner folder. Also rename the file to Configuration.js 2 | 3 | (function(context){ 4 | 5 | var Configuration = context.Configuration = {}; 6 | 7 | // Runner name 8 | Configuration.name = 'MooTools More'; 9 | 10 | 11 | // Presets - combine the sets and the source to a preset to easily run a test 12 | Configuration.presets = { 13 | 14 | 'more-all': { 15 | sets: ['1.3-all'], 16 | source: ['core-1.3-base', 'core-1.3-client'] 17 | } 18 | 19 | }; 20 | 21 | // An object with default presets 22 | Configuration.defaultPresets = { 23 | browser: 'more-all', 24 | nodejs: 'more-base', 25 | jstd: 'more-all' 26 | }; 27 | 28 | 29 | /* 30 | * An object with sets. Each item in the object should have an path key, 31 | * that specifies where the spec files are and an array with all the files 32 | * without the .js extension relative to the given path 33 | */ 34 | Configuration.sets = { 35 | 36 | '1.3-all': { 37 | path: '1.3/', 38 | files: ['Core/Lang', 'Core/Log'] 39 | } 40 | 41 | }; 42 | 43 | 44 | /* 45 | * An object with the source files. Each item should have an path key, 46 | * that specifies where the source files are and an array with all the files 47 | * without the .js extension relative to the given path 48 | */ 49 | Configuration.source = { 50 | 51 | 'core-1.3-base': { 52 | path: 'mootools-core/Source/', 53 | files: [ 54 | 'Core/Core', 55 | 56 | 'Types/Array', 57 | 'Types/Function', 58 | 'Types/Number' 59 | ] 60 | }, 61 | 'core-1.3-client': { 62 | path: 'mootools-core/Source/', 63 | files: [ 64 | 'Types/Event', 65 | 'Browser/Browser' 66 | ] 67 | } 68 | 69 | }; 70 | 71 | })(typeof exports != 'undefined' ? exports : this); 72 | -------------------------------------------------------------------------------- /test/slick/Runner/Helpers/JSSpecToJasmine.js: -------------------------------------------------------------------------------- 1 | describe = (function(original){ 2 | var each = 'before each', 3 | all = 'before all', 4 | after = 'after all'; 5 | 6 | return function(name, object){ 7 | if (object instanceof Function){ 8 | original(name, object); 9 | return; 10 | } 11 | 12 | original(name, function(){ 13 | var beforeAll = object[all], 14 | bfEach = object[each], 15 | aAll = object[after]; 16 | 17 | beforeEach(function(){ 18 | if (beforeAll){ 19 | beforeAll(); 20 | beforeAll = null; 21 | } 22 | 23 | if (bfEach) bfEach(); 24 | }); 25 | 26 | delete object[all]; 27 | delete object[each]; 28 | delete object[after]; 29 | 30 | for (var key in object) 31 | it(key, object[key]); 32 | 33 | if (aAll) it('cleans up', aAll); 34 | }); 35 | }; 36 | })(describe); 37 | -------------------------------------------------------------------------------- /test/slick/Runner/Helpers/RunnerOptions.js: -------------------------------------------------------------------------------- 1 | var puts = require('sys').puts; 2 | 3 | exports.parseOptions = function(arg){ 4 | 5 | if (!arg) arg = '{}'; 6 | 7 | var options = {}; 8 | try { 9 | options = JSON.parse(arg); 10 | } catch(e){ 11 | puts('Please provide a proper JSON-Object'); 12 | return null; 13 | } 14 | 15 | return options; 16 | 17 | }; -------------------------------------------------------------------------------- /test/slick/Runner/Helpers/simulateEvent.js: -------------------------------------------------------------------------------- 1 | 2 | var simulateEvent = function(type, args, callback){ 3 | 4 | var called = false; 5 | 6 | args = Array.prototype.slice.call(args); 7 | args.push(function(){ 8 | called = true; 9 | }); 10 | 11 | Syn[type].apply(Syn, args); 12 | 13 | waitsFor(2, function(){ 14 | return called; 15 | }); 16 | 17 | runs(callback); 18 | 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /test/slick/Runner/JSTD-Adapter/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 2 | Misko Hevery 3 | Olmo Maldonado 4 | Christoph Pojer 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /test/slick/Runner/JSTD-Adapter/README.md: -------------------------------------------------------------------------------- 1 | Jasmine adapter for JsTestDriver 2 | ================================ 3 | 4 | Author 5 | ------ 6 | me@ibolmo.com (Olmo Maldonado) 7 | misko@hevery.com (Misko Hevery) 8 | 9 | 10 | Installing 11 | ---------- 12 | Update your `JsTestDriver.conf` by prepending the jasmine library and the adapter's source files. 13 | 14 | For example: 15 | 16 | load: 17 | - "../jasmine/lib/jasmine-0.10.0.js" 18 | - "../JasmineAdapter/src/*" 19 | - "your_source_files.js" 20 | - "your_test_files.js" 21 | 22 | 23 | ### Directory Layout 24 | 25 | - src: The adapter source code. Intent is to match interface with interface. 26 | - src-test: The test files that verifies that the adapter works as intended. 27 | 28 | ### jsTestDriver.conf and *.sh files 29 | 30 | The files located in this repo assume that the parent folder has the jasmine source and a jstestdriver compiled available. 31 | Update the paths to reflect your own layout if you'd like to test the adapter. 32 | -------------------------------------------------------------------------------- /test/slick/Runner/JSTD-Adapter/jsTestDriver.conf: -------------------------------------------------------------------------------- 1 | server: http://localhost:9876 2 | 3 | load: 4 | - "../Jasmine/jasmine.js" 5 | - "src/JasmineAdapter.js" 6 | - "src-test/tests.js" 7 | -------------------------------------------------------------------------------- /test/slick/Runner/JSTD-Adapter/server.sh: -------------------------------------------------------------------------------- 1 | java -jar ../JSTestDriver/JSTestDriver.jar --port 9876 --runnerMode DEBUG 2 | -------------------------------------------------------------------------------- /test/slick/Runner/JSTD-Adapter/src-test/tests.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 3 | var depth; 4 | 5 | beforeEach(function(){ 6 | depth = 1; 7 | }); 8 | 9 | afterEach(function(){ 10 | expect(depth).toEqual(1); 11 | }); 12 | 13 | describe('describe', function(){ 14 | beforeEach(function(){ 15 | depth++; 16 | }); 17 | 18 | afterEach(function(){ 19 | depth--; 20 | }); 21 | 22 | it('should map it', function(){ 23 | expect(depth).toEqual(2); 24 | }); 25 | 26 | describe('nested', function(){ 27 | beforeEach(function(){ 28 | depth++; 29 | }); 30 | 31 | afterEach(function(){ 32 | depth--; 33 | }); 34 | 35 | it('should exectue nested', function(){ 36 | expect(depth).toEqual(3); 37 | }); 38 | }); 39 | }); 40 | 41 | describe("matchers", function(){ 42 | 43 | beforeEach(function(){ 44 | this.addMatchers({ 45 | toBePersonNamed: function(name){ 46 | return this.actual == name; 47 | } 48 | }); 49 | }); 50 | 51 | it('should work across multiple tests', function(){ 52 | expect('misko').toBePersonNamed('misko'); 53 | }); 54 | 55 | it('should allow a creation of new matcher', function(){ 56 | this.addMatchers({ 57 | toBeMe: function(){ 58 | return this.actual == 'misko'; 59 | } 60 | }); 61 | this.addMatchers({ 62 | toBeMe2: function(arg){ 63 | return this.actual == arg; 64 | } 65 | }); 66 | expect('misko').toBeMe(); 67 | expect('misko').toBeMe2('misko'); 68 | expect('adam').toBePersonNamed('adam'); 69 | }); 70 | }); 71 | 72 | describe('runs', function(){ 73 | it('should execute a runs block', function(){ 74 | runs(function(){ 75 | this.runsFunction = function(){ 76 | return true; 77 | }; 78 | spyOn(this, 'runsFunction'); 79 | }); 80 | 81 | runs(function(){ 82 | this.runsFunction(); 83 | }); 84 | 85 | runs(function(){ 86 | expect(this.runsFunction).wasCalled(); 87 | }); 88 | }); 89 | }); 90 | 91 | })(); 92 | -------------------------------------------------------------------------------- /test/slick/Runner/JSTD-Adapter/src/JasmineAdapter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Jasmine JsTestDriver Adapter. 3 | * @author ibolmo@gmail.com (Olmo Maldonado) 4 | * @author misko@hevery.com (Misko Hevery) 5 | */ 6 | 7 | (function(describe, it, beforeEach, afterEach, addResult){ 8 | 9 | var frame = function(parent, name){ 10 | var caseName = ''; 11 | if (parent && parent.caseName) caseName = parent.caseName + ' '; 12 | if (name) caseName += name; 13 | 14 | var before = [], 15 | after = []; 16 | 17 | return { 18 | name: name, 19 | caseName: caseName, 20 | parent: parent, 21 | testCase: TestCase(caseName), 22 | before: before, 23 | after: after, 24 | runBefore: function(){ 25 | if (parent) parent.runBefore.apply(this); 26 | for (var i = 0, l = before.length; i < l; i++) before[i].apply(this); 27 | }, 28 | runAfter: function(){ 29 | for (var i = 0, l = after.length; i < l; i++) after[i].apply(this); 30 | if (parent) parent.runAfter.apply(this); 31 | } 32 | }; 33 | }; 34 | 35 | var currentFrame = frame(null, null); 36 | 37 | jasmine.Env.prototype.describe = function(description, context){ 38 | currentFrame = frame(currentFrame, description); 39 | var result = describe.call(this, description, context); 40 | currentFrame = currentFrame.parent; 41 | return result; 42 | }; 43 | 44 | jasmine.Env.prototype.it = function(description, closure){ 45 | var result = it.call(this, description, closure), 46 | currentSpec = this.currentSpec, 47 | frame = this.jstdFrame = currentFrame, 48 | name = 'test that it ' + description; 49 | 50 | if (this.jstdFrame.testCase.prototype[name]) 51 | throw "Spec with name '" + description + "' already exists."; 52 | 53 | this.jstdFrame.testCase.prototype[name] = function(){ 54 | jasmine.getEnv().currentSpec = currentSpec; 55 | frame.runBefore.apply(currentSpec); 56 | try { 57 | currentSpec.queue.start(); 58 | } catch(e){} 59 | frame.runAfter.apply(currentSpec); 60 | }; 61 | return result; 62 | }; 63 | 64 | jasmine.Env.prototype.beforeEach = function(closure) { 65 | beforeEach.call(this, closure); 66 | currentFrame.before.push(closure); 67 | }; 68 | 69 | jasmine.Env.prototype.afterEach = function(closure) { 70 | afterEach.call(this, closure); 71 | currentFrame.after.push(closure); 72 | }; 73 | 74 | jasmine.NestedResults.prototype.addResult = function(result) { 75 | addResult.call(this, result); 76 | if (result.type != 'MessageResult' && !result.passed()) fail(result.message); 77 | }; 78 | 79 | // Reset environment with overriden methods. 80 | jasmine.currentEnv_ = null; 81 | jasmine.getEnv(); 82 | 83 | })(jasmine.Env.prototype.describe, jasmine.Env.prototype.it, jasmine.Env.prototype.beforeEach, jasmine.Env.prototype.afterEach, jasmine.NestedResults.prototype.addResult); 84 | -------------------------------------------------------------------------------- /test/slick/Runner/JSTD-Adapter/test.sh: -------------------------------------------------------------------------------- 1 | java -jar ../JSTestDriver/JSTestDriver.jar --tests all --reset 2 | -------------------------------------------------------------------------------- /test/slick/Runner/JSTestDriver/JSTestDriver.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/Runner/JSTestDriver/JSTestDriver.jar -------------------------------------------------------------------------------- /test/slick/Runner/JSTestDriver/plugins/coverage.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/Runner/JSTestDriver/plugins/coverage.jar -------------------------------------------------------------------------------- /test/slick/Runner/Jasmine-Node/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 Adam Abrons and Misko Hevery http://getangular.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /test/slick/Runner/Jasmine-Node/README.md: -------------------------------------------------------------------------------- 1 | jasmine-node 2 | ====== 3 | 4 | This node.js module makes the wonderful Pivotal Lab's jasmine (http://github.com/pivotal/jasmine) spec framework available in node.js. 5 | 6 | Checkout specs.js in the rood directory and spec/SampleSpecs.js to see how to use it. 7 | -------------------------------------------------------------------------------- /test/slick/Runner/Jasmine-Node/spec/SampleSpecs.js: -------------------------------------------------------------------------------- 1 | describe('jasmine-node', function(){ 2 | 3 | it('should pass', function(){ 4 | expect(1+2).toEqual(3); 5 | }); 6 | 7 | it('shows asynchronous test', function(){ 8 | setTimeout(function(){ 9 | expect('second').toEqual('second'); 10 | asyncSpecDone(); 11 | }, 1); 12 | expect('first').toEqual('first'); 13 | asyncSpecWait(); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /test/slick/Runner/Jasmine-Node/spec/TestSpec.js: -------------------------------------------------------------------------------- 1 | describe('jasmine-node-flat', function(){ 2 | it('should pass', function(){ 3 | expect(1+2).toEqual(3); 4 | }); 5 | }); -------------------------------------------------------------------------------- /test/slick/Runner/Jasmine-Node/spec/nested/NestedSpec.js: -------------------------------------------------------------------------------- 1 | describe('jasmine-node-nested', function(){ 2 | it('should pass', function(){ 3 | expect(1+2).toEqual(3); 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /test/slick/Runner/Jasmine-Node/spec/nested/uber-nested/UberNestedSpec.js: -------------------------------------------------------------------------------- 1 | describe('jasmine-node-uber-nested', function(){ 2 | it('should pass', function(){ 3 | expect(1+2).toEqual(3); 4 | }); 5 | 6 | describe('failure', function(){ 7 | it('should report failure (THIS IS EXPECTED)', function(){ 8 | expect(true).toBeFalsy(); 9 | }); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /test/slick/Runner/Jasmine-Node/specs.js: -------------------------------------------------------------------------------- 1 | require.paths.push("./lib"); 2 | var jasmine = require('jasmine'); 3 | var sys = require('sys'); 4 | 5 | for(var key in jasmine) { 6 | global[key] = jasmine[key]; 7 | } 8 | 9 | var isVerbose = false; 10 | var showColors = true; 11 | process.argv.forEach(function(arg){ 12 | switch(arg) { 13 | case '--color': showColors = true; break; 14 | case '--noColor': showColors = false; break; 15 | case '--verbose': isVerbose = true; break; 16 | } 17 | }); 18 | 19 | 20 | jasmine.executeSpecsInFolder(__dirname + '/spec', function(runner, log){ 21 | process.exit(runner.results().failedCount); 22 | }, isVerbose, showColors); 23 | -------------------------------------------------------------------------------- /test/slick/Runner/Jasmine-Node/specs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/local/bin/node specs.js $@ 4 | -------------------------------------------------------------------------------- /test/slick/Runner/README.md: -------------------------------------------------------------------------------- 1 | MooTools Core Specs 2 | =================== 3 | 4 | This repository is intended to provide the specification infrastructure for MooTools Core. 5 | 6 | The infrastructure uses Jasmine as a UnitTest-Library. It is possible to run Specs via 7 | the browser, via JSTestDriver and via NodeJS. 8 | 9 | ### Setup 10 | 11 | Clone the MooTools Core repository and initialize the submodules. 12 | 13 | Set up the Specs: 14 | 15 | cd Specs 16 | git pull origin master 17 | git submodule update --init 18 | chmod +x server test runner runner.js buildCommonJS buildJSTDConfiguration 19 | 20 | ### Requirements 21 | 22 | * NodeJS 23 | * PHP (for Packager) 24 | 25 | ### Usage 26 | 27 | * Open index.html in your favorite browser and press the right link 28 | * Run the JSTD Server 29 | * Start via ./server {options} 30 | * Point one or more browsers to http://localhost:9876 31 | * Run all tests via ./test 32 | * Run in NodeJS via ./runner.js {options} 33 | 34 | ### Available Options 35 | 36 | Options are specified via JSON. 37 | 38 | Example for JSTD 39 | ./server '{"version": 1.3, "path": "../core/", "specs": [1.2, "1.3base", "1.3client"]}' 40 | 41 | Example for NodeJS 42 | ./runner.js '{"sets": ["1.3base"], "source": "../core/"}' 43 | 44 | Options 45 | "sets" - The specs to run, see Configuration.js 46 | "source" - The source files package, see Configuration.js 47 | "preset" - You can simply use a preset with predefined sets and source, see Configuration.js -------------------------------------------------------------------------------- /test/slick/Runner/buildJSTDConfiguration.js: -------------------------------------------------------------------------------- 1 | var options = require('./Helpers/RunnerOptions').parseOptions(process.argv[2]); 2 | if (!options) return; 3 | 4 | // Initialize 5 | var loader = require('./Helpers/Loader'); 6 | var SpecLoader = loader.SpecLoader(require('../Configuration').Configuration, options); 7 | 8 | SpecLoader.setEnvName('jstd'); 9 | 10 | var data = 'server: http://localhost:9876\n\n'; 11 | data += 'load:\n'; 12 | 13 | var load = function(object, base){ 14 | for (var j = 0; j < object.length; j++) 15 | data += ' - "../' + (base || '') + object[j] + '.js"\n'; 16 | }; 17 | 18 | load([ 19 | 'Runner/Jasmine/jasmine', 20 | 'Runner/JSTD-Adapter/src/JasmineAdapter', 21 | 'Runner/Helpers/Syn', 22 | 'Runner/Helpers/JSSpecToJasmine' 23 | ]); 24 | 25 | SpecLoader.setSourceLoader(load).setSpecLoader(load).run(); 26 | 27 | // TODO check why JSTD Coverage fails 28 | if (options.coverage){ 29 | data += 'plugin:\n'; 30 | data += ' - name: "coverage"\n'; 31 | data += ' jar: "JSTestDriver/plugins/coverage.jar"\n'; 32 | } 33 | 34 | var fs = require('fs'); 35 | fs.writeFile('./jsTestDriver.conf', data); -------------------------------------------------------------------------------- /test/slick/Runner/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Spec Runner 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 |

Specs for

13 | 14 |
    15 | 22 |
23 | 24 |
25 | 26 | -------------------------------------------------------------------------------- /test/slick/Runner/jsTestDriverServer.conf: -------------------------------------------------------------------------------- 1 | server: http://localhost:9876 -------------------------------------------------------------------------------- /test/slick/Runner/reports/README: -------------------------------------------------------------------------------- 1 | Directory for junit reports. 2 | -------------------------------------------------------------------------------- /test/slick/Runner/runner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 52 | 53 | MooTools-Runner 54 | 55 | 56 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /test/slick/Runner/runner.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // Runs Specs in NodeJS 3 | 4 | var puts = require('sys').puts; 5 | 6 | 7 | var options = require('./Helpers/RunnerOptions').parseOptions(process.argv[2]); 8 | if (!options) return; 9 | 10 | // Initialize 11 | var loader = require('./Helpers/Loader'); 12 | var SpecLoader = loader.SpecLoader(require('../Configuration').Configuration, options); 13 | 14 | SpecLoader.setEnvName('nodejs'); 15 | 16 | // set method to require all the sourcefiles and append the objects to this object 17 | var self = this; 18 | var append = function(original){ 19 | for (var i = 1, l = arguments.length; i < l; i++){ 20 | var extended = arguments[i] || {}; 21 | for (var key in extended) original[key] = extended[key]; 22 | } 23 | return original; 24 | }; 25 | 26 | SpecLoader.setSourceLoader(function(object, base){ 27 | for (var j = 0; j < object.length; j++){ 28 | if (object[j] == 'Slick/Slick.Parser'){ 29 | Slick = require('../' + (base || '') + object[j]).Slick; 30 | append(self, Slick); 31 | } else { 32 | append(self, require('../' + (base || '') + object[j])); 33 | } 34 | 35 | } 36 | }); 37 | 38 | 39 | // Set method to get all the spec files 40 | var specs = []; 41 | SpecLoader.setSpecLoader(function(object, base){ 42 | for (var j = 0; j < object.length; j++) 43 | specs.push(__dirname + '/../' + (base || '') + object[j]); 44 | }); 45 | 46 | 47 | // Run loader 48 | SpecLoader.run(); 49 | 50 | 51 | // Fire jasmine 52 | require.paths.push('./Jasmine-Node/lib'); 53 | 54 | var jasmine = require('jasmine'), 55 | sys = require('sys'); 56 | 57 | for(var key in jasmine) 58 | global[key] = jasmine[key]; 59 | 60 | require('./Helpers/JSSpecToJasmine'); 61 | 62 | var reporter = require('reporters/' + (options.reporter || 'console')).Reporter; 63 | reporter.done = function(runner, log){ 64 | process.exit(runner.results().failedCount); 65 | }; 66 | 67 | jasmine.runSpecs(specs, reporter); 68 | -------------------------------------------------------------------------------- /test/slick/Runner/server: -------------------------------------------------------------------------------- 1 | java -jar ./JSTestDriver/JSTestDriver.jar --config jsTestDriverServer.conf --port 9876 --runnerMode DEBUG 2 | -------------------------------------------------------------------------------- /test/slick/Runner/server.bat: -------------------------------------------------------------------------------- 1 | java -jar ./JSTestDriver/JSTestDriver.jar --config jsTestDriverServer.conf --port 9876 --runnerMode DEBUG -------------------------------------------------------------------------------- /test/slick/Runner/test: -------------------------------------------------------------------------------- 1 | node buildJSTDConfiguration.js "$1" 2 | java -jar ./JSTestDriver/JSTestDriver.jar --config jsTestDriver.conf --tests all --reset 3 | -------------------------------------------------------------------------------- /test/slick/Runner/test.bat: -------------------------------------------------------------------------------- 1 | node buildJSTDConfiguration.js '%*' 2 | java -jar ./JSTestDriver/JSTestDriver.jar --config jsTestDriver.conf --tests all --reset -------------------------------------------------------------------------------- /test/slick/assets/getgetter.js: -------------------------------------------------------------------------------- 1 | // -*- Mode: JavaScript; tab-width: 4; -*- 2 | 3 | (function(){ 4 | 5 | window.scripts_to_get = window.scripts_to_get || parent.scripts_to_get || window.location.search.match(/\bscript=(.*?\.js)/gi) || []; 6 | 7 | 8 | 9 | for (var i=0, scriptsrc; scriptsrc = scripts_to_get[i]; i++){ 10 | 11 | scripts_to_get[i] = scriptsrc = decodeURIComponent(scriptsrc.replace(/^(&?script=)+/, '')); 12 | scriptsrc.replace(/^(?!=http|\/)/, '../'); 13 | 14 | var written; 15 | 16 | if (document.write){ 17 | try { 18 | document.write('<\/script>'); 19 | written = true; 20 | } catch(e){ 21 | written = false; 22 | } 23 | } 24 | 25 | if (!written && document.documentElement.nodeName.toLowerCase() == 'html'){ 26 | var script = document.createElement('script'); 27 | script.setAttribute('src', scriptsrc); 28 | script.setAttribute('type', 'text/javascript'); 29 | document.documentElement.appendChild(script); 30 | } 31 | 32 | // else evalRemote(scriptsrc); 33 | 34 | if (/\bbootstrap\b/.test(scriptsrc)) scripts_to_get.splice(i, 1); 35 | 36 | } 37 | 38 | this.frameworkName = (scripts_to_get[0] || '').replace(/^.*\//, ''); 39 | 40 | // function evalRemote(url){ 41 | // if (!(/^(\/|http:)/).test(url) && /\bmocks\b/.test(document.location.href)) url = '../' + url; 42 | // 43 | // var code = getResource(url); 44 | // 45 | // try { 46 | // globalEval(code); 47 | // } catch(e){ 48 | // try{console.log(e);}catch(e){}; 49 | // } 50 | // }; 51 | // 52 | // function getResource(url) { 53 | // if (!(XMLHttpRequest || ActiveXObject)) return false; 54 | // request = (XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); 55 | // if (!request) return false; 56 | // request.open("GET", url + '?' + Math.random().toString(32), false); 57 | // // try { 58 | // request.send(null); 59 | // // } catch(e){} 60 | // 61 | // if (request.status != 200) return false; 62 | // return request.responseText; 63 | // } 64 | // 65 | })(); 66 | -------------------------------------------------------------------------------- /test/slick/assets/ie.css: -------------------------------------------------------------------------------- 1 | /* 2 | curl -s http://tripledoubleyou.subtlegradient.com/c/blueprint/ie.css #*/ 3 | /* ----------------------------------------------------------------------- 4 | 5 | 6 | Blueprint CSS Framework 0.9 7 | http://blueprintcss.org 8 | 9 | * Copyright (c) 2007-Present. See LICENSE for more info. 10 | * See README for instructions on how to use Blueprint. 11 | * For credits and origins, see AUTHORS. 12 | * This is a compressed file. See the sources in the 'src' directory. 13 | 14 | ----------------------------------------------------------------------- */ 15 | 16 | /* ie.css */ 17 | body {text-align:center;} 18 | .container {text-align:left;} 19 | * html .column, * html div.span-1, * html div.span-2, * html div.span-3, * html div.span-4, * html div.span-5, * html div.span-6, * html div.span-7, * html div.span-8, * html div.span-9, * html div.span-10, * html div.span-11, * html div.span-12, * html div.span-13, * html div.span-14, * html div.span-15, * html div.span-16, * html div.span-17, * html div.span-18, * html div.span-19, * html div.span-20, * html div.span-21, * html div.span-22, * html div.span-23, * html div.span-24 {display:inline;overflow-x:hidden;} 20 | * html legend {margin:0px -8px 16px 0;padding:0;} 21 | sup {vertical-align:text-top;} 22 | sub {vertical-align:text-bottom;} 23 | html>body p code {*white-space:normal;} 24 | hr {margin:-8px auto 11px;} 25 | img {-ms-interpolation-mode:bicubic;} 26 | .clearfix, .container {display:inline-block;} 27 | * html .clearfix, * html .container {height:1%;} 28 | fieldset {padding-top:0;} 29 | textarea {overflow:auto;} 30 | input.text, input.title, textarea {background-color:#fff;border:1px solid #bbb;} 31 | input.text:focus, input.title:focus {border-color:#666;} 32 | input.text, input.title, textarea, select {margin:0.5em 0;} 33 | input.checkbox, input.radio {position:relative;top:.25em;} 34 | form.inline div, form.inline p {vertical-align:middle;} 35 | form.inline label {position:relative;top:-0.25em;} 36 | form.inline input.checkbox, form.inline input.radio, form.inline input.button, form.inline button {margin:0.5em 0;} 37 | button, input.button {position:relative;top:0.25em;} 38 | -------------------------------------------------------------------------------- /test/slick/assets/moobugger/bookmarklet.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | bugger 9 | 10 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 |

The MooBugger.

41 |

moobugger - bookmark it!

42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /test/slick/assets/moobugger/debugger.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | debugger 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |
21 | 22 |
23 |
24 | 25 | -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/close.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/error.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/group-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/group-close.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/group-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/group-open.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/icon.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/info.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/lick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/lick.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/max.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/min.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/min.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/mootools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/mootools.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/time.png -------------------------------------------------------------------------------- /test/slick/assets/moobugger/images/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/assets/moobugger/images/warning.png -------------------------------------------------------------------------------- /test/slick/assets/simple_request.js: -------------------------------------------------------------------------------- 1 | var SimpleRequest = (function(){ 2 | 3 | /** 4 | * Parse the XML document contained in the string argument and return 5 | * a Document object that represents it. 6 | */ 7 | var parseXML = (function(){ 8 | // Mozilla, Firefox, and related browsers 9 | return (typeof DOMParser != "undefined") ? function(rawXML){ 10 | return (new DOMParser()).parseFromString(rawXML, "application/xml"); 11 | } : (typeof ActiveXObject != "undefined") ? function(rawXML){ 12 | var xmlDocument = new ActiveXObject("Microsoft.XMLDOM"); 13 | xmlDocument.async = false; 14 | xmlDocument.loadXML(rawXML); 15 | if (xmlDocument.parseError && xmlDocument.parseError.errorCode) 16 | xmlDocument.loadXML(rawXML.replace(/]*?>/i,'')); 17 | if (xmlDocument.parseError && xmlDocument.parseError.errorCode) 18 | throw new Error(['' 19 | ,("Error code: " + xmlDocument.parseError.errorCode) 20 | ,("Error reason: " + xmlDocument.parseError.reason) 21 | ,("Error line: " + xmlDocument.parseError.line) 22 | ,rawXML 23 | ].join('\n')); 24 | return xmlDocument; 25 | } : function(){ 26 | return null; 27 | }; 28 | })(); 29 | 30 | function SimpleRequest(){ 31 | this.initialize(); 32 | }; 33 | 34 | SimpleRequest.prototype = { 35 | 36 | initialize: function(){ 37 | this.xhr = this.createXHR(); 38 | }, 39 | 40 | createXHR: function(){ 41 | // return ('XMLHttpRequest' in window)? new XMLHttpRequest(): new ActiveXObject('MSXML2.XMLHTTP'); 42 | return ('XMLHttpRequest' in window) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); 43 | }, 44 | 45 | stateChange: function(fn){ 46 | if(this.xhr.readyState == 4 && this.xhr.status == 200){ 47 | fn.apply(this, [this.xhr.responseText, this.getXML()]); 48 | } 49 | }, 50 | 51 | getXML: function(){ 52 | if (this.xhr.responseXML && this.xhr.responseXML.documentElement) 53 | return this.xhr.responseXML; 54 | return parseXML(this.xhr.responseText); 55 | }, 56 | 57 | send: function(url, fn){ 58 | var self = this; 59 | this.xhr.onreadystatechange = function(){ self.stateChange(fn); }; 60 | this.xhr.open('get', url + '?n=' + (new Date()).getTime(), true); 61 | this.xhr.send(null); 62 | } 63 | 64 | }; 65 | 66 | return SimpleRequest; 67 | })(); 68 | -------------------------------------------------------------------------------- /test/slick/bootstrap/moo12.slickspec.js: -------------------------------------------------------------------------------- 1 | var setupMethods = function(specs, window){ 2 | var Element = window.Element || global.Element; 3 | global.disableNegNth = true; 4 | global.cannotDisableQSA = true; 5 | 6 | window.SELECT = function(context, selector, append){ 7 | return Element.getElements(context, selector); 8 | }; 9 | window.SELECT1 = function(context, selector){ 10 | return Element.getElement(context, selector); 11 | }; 12 | window.MATCH = function(context, selector){ 13 | return Element.match(context, selector); 14 | }; 15 | // window.isXML = function(document){ 16 | // return Slick.isXML(document); 17 | // }; 18 | // window.PARSE = function(selector){ 19 | // return Slick.parse(selector); 20 | // }; 21 | } 22 | 23 | var verifySetupMethods = function(specs, window){ 24 | describe('Verify Setup',function(){ 25 | it('should define SELECT', function(){ 26 | expect( typeof window.SELECT ).toEqual('function'); 27 | expect( window.SELECT(window.document, '*').length ).not.toEqual(0); 28 | }); 29 | it('should define MATCH', function(){ 30 | expect( typeof window.MATCH ).toEqual('function'); 31 | expect( window.MATCH(window.document.documentElement, '*') ).toEqual(true); 32 | }); 33 | // it('should define isXML', function(){ 34 | // expect( typeof window.isXML ).toEqual('function'); 35 | // expect( typeof window.isXML(window.document) ).toEqual('boolean'); 36 | // }); 37 | }); 38 | }; 39 | 40 | var verifySetupContext = function(specs, context){ 41 | describe('Verify Context',function(){ 42 | 43 | it('should set the context properly', function(){ 44 | expect(context.document).toBeDefined(); 45 | expect(context.document.nodeType).toEqual(9); 46 | 47 | var title = context.document.getElementsByTagName('title'); 48 | for (var i=0, l=title.length; i < l; i++) 49 | if (title[i].firstChild) 50 | expect(title[i].firstChild.nodeValue).not.toMatch(404); 51 | 52 | }); 53 | 54 | }); 55 | }; 56 | -------------------------------------------------------------------------------- /test/slick/bootstrap/nwmatcher.slickspec.js: -------------------------------------------------------------------------------- 1 | var setupMethods = function(window){ 2 | var NW = window.NW || global.NW; 3 | 4 | NW.Dom.configure({ 5 | 'CACHING': false, 6 | 'ESCAPECHR': true, 7 | 'NON_ASCII': true, 8 | 'UNICODE16': true, 9 | 'SIMPLENOT': false, 10 | 'SHORTCUTS': true, 11 | 'USE_HTML5': true 12 | }); 13 | 14 | 15 | // V1.x 16 | NW.Dom.registerOperator('!=', 'n!="%m"'); 17 | 18 | // V2.x 19 | // NW.Dom.registerOperator('!=', { p1: '^', p2: '$', p3: 'false' }); 20 | 21 | window.SELECT = function(from, selector, data) { 22 | NW.Dom.configure({ 'USE_QSAPI': !window.SELECT.disableQSA }); 23 | if (data) { 24 | NW.Dom.select(selector, from, function(element) { data.push(element); }); 25 | return data; 26 | } 27 | return NW.Dom.select(selector, from); 28 | }; 29 | 30 | window.SELECT1 = function(from, selector){ 31 | NW.Dom.configure({ 'USE_QSAPI': !window.SELECT.disableQSA }); 32 | return NW.Dom.select(selector, from)[0] || null; 33 | }; 34 | 35 | window.MATCH = function(context, selector, root){ 36 | NW.Dom.configure({ 'USE_QSAPI': !window.SELECT.disableQSA }); 37 | return NW.Dom.match(selector, context, root); 38 | }; 39 | 40 | window.isXML = function(element){ 41 | var ownerDocument = element.ownerDocument || element; 42 | return !('body' in ownerDocument) || !('innerHTML' in ownerDocument.documentElement) || 43 | ownerDocument.createElement('DiV').nodeName == 'DiV'; 44 | }; 45 | 46 | window.SELECTOR = window.SELECT; 47 | }; 48 | 49 | var verifySetupMethods = function(window){ 50 | describe('Verify Setup', function(){ 51 | it('should define SELECT', function(){ 52 | expect( typeof window.SELECT ).toEqual('function'); 53 | expect( window.SELECT(window.document, '*').length ).not.toEqual(0); 54 | }); 55 | 56 | it('should define SELECT1', function(){ 57 | expect( typeof window.SELECT1 ).toEqual('function'); 58 | expect( window.SELECT1(window.document, '*') ).not.toBeNull(); 59 | }); 60 | 61 | it('should define MATCH', function(){ 62 | expect( typeof window.MATCH ).toEqual('function'); 63 | expect( window.MATCH(window.document.documentElement, '*') ).toEqual(true); 64 | }); 65 | 66 | it('should define isXML', function(){ 67 | expect( typeof window.isXML ).toEqual('function'); 68 | expect( typeof window.isXML(window.document) ).toEqual('boolean'); 69 | }); 70 | }); 71 | }; 72 | 73 | var verifySetupContext = function(context){ 74 | describe('Verify Context', function(){ 75 | it('should set the context properly', function(){ 76 | expect(context.document).toBeDefined(); 77 | expect(context.document.nodeType).toEqual(9); 78 | var title = context.document.getElementsByTagName('title'); 79 | for (var i=0, l=title.length; i < l; i++){ 80 | if (title[i].firstChild) 81 | expect(title[i].firstChild.nodeValue).not.toMatch(404); 82 | } 83 | }); 84 | }); 85 | }; -------------------------------------------------------------------------------- /test/slick/bootstrap/nwsapi.slickspec.js: -------------------------------------------------------------------------------- 1 | var setupMethods = function(window){ 2 | var NW = window.NW || global.NW; 3 | 4 | NW.Dom.configure({ 5 | 'CACHING': false, 6 | 'ESCAPECHR': true, 7 | 'NON_ASCII': true, 8 | 'UNICODE16': true, 9 | 'SIMPLENOT': false, 10 | 'SHORTCUTS': true, 11 | 'USE_HTML5': true 12 | }); 13 | 14 | 15 | // V1.x 16 | // NW.Dom.registerOperator('!=', 'n!="%m"'); 17 | 18 | // V2.x 19 | NW.Dom.registerOperator('!=', { p1: '^', p2: '$', p3: 'false' }); 20 | 21 | window.SELECT = function(from, selector, data) { 22 | // NW.Dom.configure({ 'USE_QSAPI': !window.SELECT.disableQSA }); 23 | if (data) { 24 | NW.Dom.select(selector, from, function(element) { data.push(element); }); 25 | return data; 26 | } 27 | return NW.Dom.select(selector, from); 28 | }; 29 | 30 | window.SELECT1 = function(from, selector){ 31 | // NW.Dom.configure({ 'USE_QSAPI': !window.SELECT.disableQSA }); 32 | return NW.Dom.select(selector, from)[0] || null; 33 | }; 34 | 35 | window.MATCH = function(context, selector, root){ 36 | // NW.Dom.configure({ 'USE_QSAPI': !window.SELECT.disableQSA }); 37 | return NW.Dom.match(selector, context, root); 38 | }; 39 | 40 | window.isXML = function(element){ 41 | var ownerDocument = element.ownerDocument || element; 42 | return !('body' in ownerDocument) || !('innerHTML' in ownerDocument.documentElement) || 43 | ownerDocument.createElement('DiV').nodeName == 'DiV'; 44 | }; 45 | 46 | window.SELECTOR = window.SELECT; 47 | }; 48 | 49 | var verifySetupMethods = function(window){ 50 | describe('Verify Setup', function(){ 51 | it('should define SELECT', function(){ 52 | expect( typeof window.SELECT ).toEqual('function'); 53 | expect( window.SELECT(window.document, '*').length ).not.toEqual(0); 54 | }); 55 | 56 | it('should define SELECT1', function(){ 57 | expect( typeof window.SELECT1 ).toEqual('function'); 58 | expect( window.SELECT1(window.document, '*') ).not.toBeNull(); 59 | }); 60 | 61 | it('should define MATCH', function(){ 62 | expect( typeof window.MATCH ).toEqual('function'); 63 | expect( window.MATCH(window.document.documentElement, '*') ).toEqual(true); 64 | }); 65 | 66 | it('should define isXML', function(){ 67 | expect( typeof window.isXML ).toEqual('function'); 68 | expect( typeof window.isXML(window.document) ).toEqual('boolean'); 69 | }); 70 | }); 71 | }; 72 | 73 | var verifySetupContext = function(context){ 74 | describe('Verify Context', function(){ 75 | it('should set the context properly', function(){ 76 | expect(context.document).toBeDefined(); 77 | expect(context.document.nodeType).toEqual(9); 78 | var title = context.document.getElementsByTagName('title'); 79 | for (var i=0, l=title.length; i < l; i++){ 80 | if (title[i].firstChild) 81 | expect(title[i].firstChild.nodeValue).not.toMatch(404); 82 | } 83 | }); 84 | }); 85 | }; -------------------------------------------------------------------------------- /test/slick/bootstrap/sizzle.slickspec.js: -------------------------------------------------------------------------------- 1 | var setupMethods = function(specs, window){ 2 | global.cannotDisableQSA = true; 3 | 4 | var jQuery = window.jQuery || global.jQuery || function(){}; 5 | var Sizzle = window.Sizzle || global.Sizzle || jQuery() && function(selector, context, append, seed){ 6 | if (seed) return Array.prototype.slice.call(jQuery(seed).filter(selector).get()); 7 | return Array.prototype.slice.call(jQuery(append || []).add(selector, context).get()); 8 | }; 9 | 10 | var isXML = jQuery.isXMLDoc || function(elem){ 11 | return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || 12 | !!elem.ownerDocument && isXML( elem.ownerDocument ); 13 | }; 14 | 15 | window.SELECT = function(context, selector, append){ 16 | return Sizzle(selector, context, append); 17 | }; 18 | window.SELECT1 = function(context, selector){ 19 | return Sizzle(selector + ':first', context)[0]; 20 | }; 21 | window.MATCH = function(context, selector, root){ 22 | return !!Sizzle(selector, null, null, [context]).length; 23 | }; 24 | window.isXML = function(document){ 25 | return isXML(document); 26 | }; 27 | }; 28 | 29 | var verifySetupMethods = function(specs, window){ 30 | describe('Verify Setup',function(){ 31 | it('should define SELECT', function(){ 32 | expect( typeof window.SELECT ).toEqual('function'); 33 | expect( window.SELECT(window.document, '*').length ).not.toEqual(0); 34 | }); 35 | it('should define SELECT1', function(){ 36 | expect( typeof window.SELECT1 ).toEqual('function'); 37 | expect( window.SELECT1(window.document, '*') ).not.toBeNull(); 38 | }); 39 | it('should define MATCH', function(){ 40 | expect( typeof window.MATCH ).toEqual('function'); 41 | expect( window.MATCH(window.document.documentElement, '*') ).toEqual(true); 42 | }); 43 | it('should define isXML', function(){ 44 | expect( typeof window.isXML ).toEqual('function'); 45 | expect( typeof window.isXML(window.document) ).toEqual('boolean'); 46 | }); 47 | }); 48 | }; 49 | 50 | var verifySetupContext = function(specs, context){ 51 | describe('Verify Context',function(){ 52 | 53 | it('should set the context properly', function(){ 54 | expect(context.document).toBeDefined(); 55 | expect(context.document.nodeType).toEqual(9); 56 | 57 | var title = context.document.getElementsByTagName('title'); 58 | for (var i=0, l=title.length; i < l; i++) 59 | if (title[i].firstChild) 60 | expect(title[i].firstChild.nodeValue).not.toMatch(404); 61 | 62 | }); 63 | 64 | }); 65 | }; 66 | -------------------------------------------------------------------------------- /test/slick/bootstrap/slick.slickspec.js: -------------------------------------------------------------------------------- 1 | var setupMethods = function(window){ 2 | var Slick = window.Slick || global.Slick; 3 | 4 | window.SELECT = function(context, selector, append){ 5 | return Slick.search(context, selector, append); 6 | }; 7 | window.SELECT1 = function(context, selector){ 8 | return Slick.find(context, selector); 9 | }; 10 | window.MATCH = function(context, selector, root){ 11 | return Slick.match(context, selector, root); 12 | }; 13 | window.isXML = function(document){ 14 | return Slick.isXML(document); 15 | }; 16 | window.PARSE = function(selector){ 17 | return Slick.parse(selector); 18 | }; 19 | 20 | window.SELECTOR = Slick; 21 | }; 22 | 23 | var verifySetupMethods = function(window){ 24 | describe('Verify Setup', function(){ 25 | it('should define SELECT', function(){ 26 | expect( typeof window.SELECT ).toEqual('function'); 27 | expect( window.SELECT(window.document, '*').length ).not.toEqual(0); 28 | }); 29 | 30 | it('should define SELECT1', function(){ 31 | expect( typeof window.SELECT1 ).toEqual('function'); 32 | expect( window.SELECT1(window.document, '*') ).not.toBeNull(); 33 | }); 34 | 35 | it('should define MATCH', function(){ 36 | expect( typeof window.MATCH ).toEqual('function'); 37 | expect( window.MATCH(window.document.documentElement, '*') ).toEqual(true); 38 | }); 39 | 40 | it('should define isXML', function(){ 41 | expect( typeof window.isXML ).toEqual('function'); 42 | expect( typeof window.isXML(window.document) ).toEqual('boolean'); 43 | }); 44 | 45 | it('should define PARSE', function(){ 46 | expect( typeof window.PARSE ).toEqual('function'); 47 | expect( typeof window.PARSE('*') ).toEqual('object'); 48 | expect( window.PARSE('*').expressions.length ).toEqual(1); 49 | expect( window.PARSE('*').expressions[0].length ).toEqual(1); 50 | }); 51 | }); 52 | }; 53 | 54 | var verifySetupContext = function(context){ 55 | describe('Verify Context', function(){ 56 | it('should set the context properly', function(){ 57 | expect(context.document).toBeDefined(); 58 | expect(context.document.nodeType).toEqual(9); 59 | var title = context.document.getElementsByTagName('title'); 60 | for (var i=0, l=title.length; i < l; i++){ 61 | if (title[i].firstChild) 62 | expect(title[i].firstChild.nodeValue).not.toMatch(404); 63 | } 64 | }); 65 | }); 66 | }; 67 | -------------------------------------------------------------------------------- /test/slick/bootstrap/yui.slickspec.js: -------------------------------------------------------------------------------- 1 | var setupMethods = function(specs, window){ 2 | global.cannotDisableQSA = true; 3 | 4 | var YAHOO_util_Selector = (window.YAHOO || global.YAHOO).util.Selector; 5 | 6 | window.SELECT = function(context, selector, append){ 7 | return YAHOO_util_Selector.query(selector, context); 8 | }; 9 | window.SELECT1 = function(context, selector){ 10 | return YAHOO_util_Selector.query(selector, context, true); 11 | }; 12 | window.MATCH = function(context, selector){ 13 | return YAHOO_util_Selector.test(context, selector); 14 | }; 15 | window.isXML = TODO; 16 | }; 17 | 18 | var verifySetupMethods = function(specs, window){ 19 | describe('Verify Setup',function(){ 20 | it('should define SELECT', function(){ 21 | expect( typeof window.SELECT ).toEqual('function'); 22 | expect( window.SELECT(window.document, '*').length ).not.toEqual(0); 23 | }); 24 | it('should define SELECT1', function(){ 25 | expect( typeof window.SELECT1 ).toEqual('function'); 26 | expect( window.SELECT1(window.document, '*').length ).not.toEqual(0); 27 | }); 28 | it('should define MATCH', function(){ 29 | expect( typeof window.MATCH ).toEqual('function'); 30 | expect( window.MATCH(window.document.documentElement, '*') ).toEqual(true); 31 | }); 32 | it('should define isXML', function(){ 33 | expect( typeof window.isXML ).toEqual('function'); 34 | }); 35 | }); 36 | }; 37 | -------------------------------------------------------------------------------- /test/slick/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Spec Runner 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 |

Specs for

13 | 14 |
    15 | 22 |
23 | 24 |
25 | 26 | -------------------------------------------------------------------------------- /test/slick/mocks/blank.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | iframe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/slick/mocks/data/iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | iframe 4 | 5 | 6 |
span text
7 | 8 | 9 | -------------------------------------------------------------------------------- /test/slick/mocks/first-letter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/mocks/first-letter.gif -------------------------------------------------------------------------------- /test/slick/mocks/first-letter2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/mocks/first-letter2.gif -------------------------------------------------------------------------------- /test/slick/mocks/initial-cap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/slick/mocks/initial-cap.png -------------------------------------------------------------------------------- /test/slick/mocks/query_test-google_closure.html: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 21 | 22 | 23 | Closure Unit Tests - goog.dom 24 | 25 | 26 | 27 |

testing goog.dom.query()

28 |
29 |

h3 span endh3

30 | 31 |
32 |

h3

33 | 34 | 35 |
36 |

h3

37 |

h3

38 | 39 | 40 | 41 | 42 | 43 |
44 |
45 |
46 |
47 |
48 |
49 | 50 | 51 |
52 | 53 |
54 | 55 | 56 | 57 | 58 | 59 | 60 |
61 | 62 | 63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /test/slick/mocks/query_test-slick.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mootools Query Test 6 | 7 | 8 | 9 | some 10 | some 11 | some 12 |
some
13 |
some
14 |
some
15 | 16 |
text
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /test/slick/mocks/test-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | iframe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/slick/mocks/test.css: -------------------------------------------------------------------------------- 1 | body, div, p, h1, h2, h3, ul, ol, span, a, table, td, form, img, li { 2 | font-family: sans-serif; 3 | } 4 | 5 | body { 6 | font-size:0.8em; 7 | } 8 | 9 | #log { 10 | padding-bottom: 1em; 11 | border-bottom: 2px solid #000; 12 | margin-bottom: 2em; 13 | } 14 | 15 | .logsummary { 16 | margin-top: 1em; 17 | margin-bottom: 1em; 18 | padding: 1ex; 19 | border: 1px solid #000; 20 | font-weight: bold; 21 | } 22 | 23 | .logtable { 24 | width:100%; 25 | border-collapse: collapse; 26 | border: 1px dotted #666; 27 | } 28 | 29 | .logtable td, .logtable th { 30 | text-align: left; 31 | padding: 3px 8px; 32 | border: 1px dotted #666; 33 | } 34 | 35 | .logtable .passed { 36 | background-color: #cfc; 37 | } 38 | 39 | .logtable .failed, .logtable .error { 40 | background-color: #fcc; 41 | } 42 | 43 | .logtable td div.action_buttons { 44 | display: inline; 45 | } 46 | 47 | .logtable td div.action_buttons input { 48 | margin: 0 5px; 49 | font-size: 10px; 50 | } -------------------------------------------------------------------------------- /test/slick/mocks/xml.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | tes 4 | 5 | html 6 | 7 | 8 | tes 9 | 10 | 11 | 12 | 13 | 14 | text 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/slick/parent.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Parent window 6 | 7 | 8 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/slick/quirks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | quirks test 5 | 12 | 13 | 14 |
15 |
16 |
17 |
18 | 19 | -------------------------------------------------------------------------------- /test/slick/specrunner_browser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Browser Bugs (some should fail) :: SlickSpec 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 35 | 36 |

SlickSpec

37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 60 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /test/slick/specs/html.js: -------------------------------------------------------------------------------- 1 | var specsSlickHtml = function(context){ 2 | 3 | var makeSlickTestSearch = function(selector, count, disableQSA) { 4 | return function(){ 5 | context.SELECTOR.disableQSA = !!disableQSA; 6 | var selectedArray = context.SELECT(context.document, selector); 7 | var selected = context.SELECT1(context.document, selector); 8 | expect( selectedArray.length ).toEqual( count ); 9 | if (count){ 10 | expect( selected ).not.toBeNull(); 11 | expect( selected ).toEqual(selectedArray[0]); 12 | expect( context.MATCH(selectedArray[0], selector) ).toEqual( true ); 13 | } else { 14 | expect( selected ).toBeNull(); 15 | } 16 | delete context.SELECTOR.disableQSA; 17 | }; 18 | }; 19 | 20 | var itShouldFind = function(count, selector){ 21 | if (global.document.querySelectorAll && !global.cannotDisableQSA) 22 | it('should find '+count+' `'+selector+'` with QSA', makeSlickTestSearch(selector, count, false)); 23 | it('should find '+count+' `'+selector + (!global.cannotDisableQSA ? '` without QSA' : ''), makeSlickTestSearch(selector, count, true)); 24 | }; 25 | 26 | describe('Slick', function(){ 27 | 28 | itShouldFind(1, 'body a[tabindex="0"]'); 29 | itShouldFind(1, 'body a[tabindex="1"]'); 30 | itShouldFind(2, 'body a[tabindex]'); 31 | itShouldFind(2, 'body [tabindex="0"]'); 32 | itShouldFind(2, 'body [tabindex="1"]'); 33 | itShouldFind(4, 'body [tabindex]'); 34 | 35 | /* 36 | describe('Combinators', function(){ 37 | 38 | it('should find `~`', function(){ 39 | expect(context.SELECT1(context.document.getElementById('one'), '~')).not.toBeNull(); 40 | }); 41 | it('should find `~div`', function(){ 42 | expect(context.SELECT1(context.document.getElementById('one'), '~div')).not.toBeNull(); 43 | }); 44 | it('should find `> i`', function(){ 45 | expect(context.SELECT1(context.document.getElementById('one'), '> i')).not.toBeNull(); 46 | }); 47 | it('should find `+`', function(){ 48 | expect(context.SELECT1(context.document.getElementById('one'), '+')).not.toBeNull(); 49 | }); 50 | it('should find `+div`', function(){ 51 | expect(context.SELECT1(context.document.getElementById('one'), '+div')).not.toBeNull(); 52 | }); 53 | 54 | }); 55 | */ 56 | 57 | 58 | }); 59 | 60 | }; 61 | -------------------------------------------------------------------------------- /test/slick/specs/html5.js: -------------------------------------------------------------------------------- 1 | var specsHTML5 = function(context){ 2 | 3 | var makeSlickTestSearch = function(selector, count, disableQSA) { 4 | return function(){ 5 | context.SELECTOR.disableQSA = !!disableQSA; 6 | var selectedArray = context.SELECT(context.document, selector); 7 | var selected = context.SELECT1(context.document, selector); 8 | expect( selectedArray.length ).toEqual( count ); 9 | if (count){ 10 | expect( selected ).not.toBeNull(); 11 | expect( selected ).toEqual(selectedArray[0]); 12 | expect( context.MATCH(selectedArray[0], selector) ).toEqual( true ); 13 | } else { 14 | expect( selected ).toBeNull(); 15 | } 16 | delete context.SELECTOR.disableQSA; 17 | }; 18 | }; 19 | 20 | var itShouldFind = function(count, selector){ 21 | if (global.document.querySelectorAll && !global.cannotDisableQSA) 22 | it('should find '+count+' `'+selector+'` with QSA', makeSlickTestSearch(selector, count, false)); 23 | it('should find '+count+' `'+selector + (!global.cannotDisableQSA ? '` without QSA' : ''), makeSlickTestSearch(selector, count, true)); 24 | }; 25 | 26 | describe('HTML5 new tags', function(){ 27 | 28 | itShouldFind(2, 'section'); 29 | itShouldFind(1, '#page header nav'); 30 | itShouldFind(1, 'header[role="banner"]'); 31 | 32 | }); 33 | 34 | describe('HTML5 new input types', function(){ 35 | 36 | itShouldFind(1, 'input[type="search"]'); 37 | 38 | }); 39 | 40 | }; -------------------------------------------------------------------------------- /test/slick/specs/isxml.js: -------------------------------------------------------------------------------- 1 | var specsIsXML = function(context){ 2 | 3 | describe('is XML',function(){ 4 | it('should be XML', function(){ 5 | expect( context.document.nodeType ).toEqual(9); 6 | expect( context.document ).not.toEqual( global.document ); 7 | expect(context.isXML(context.document)).toEqual(true); 8 | }); 9 | }); 10 | 11 | }; 12 | 13 | 14 | var specsIsNotXML = function(context){ 15 | 16 | describe('is not XML',function(){ 17 | it('should not be XML', function(){ 18 | expect( context.document.nodeType ).toEqual(9); 19 | expect( context.document ).not.toEqual( global.document ); 20 | expect(context.isXML(context.document)).toEqual(false); 21 | }); 22 | }); 23 | 24 | }; -------------------------------------------------------------------------------- /test/slick/specs/select_nth-child.js: -------------------------------------------------------------------------------- 1 | var specsSelectNthChild = function(context){ 2 | 3 | describe('nth-child', function(){ 4 | 5 | var document = context.document; 6 | var parent = document.createElement('div'); 7 | 8 | for (var i = 1, el; i <= 10; i++){ 9 | el = document.createElement('div'); 10 | el.appendChild(document.createTextNode(i)); 11 | parent.appendChild(el); 12 | }; 13 | 14 | var shouldSelect = function(selector, items){ 15 | var result = context.SELECT(parent, selector); 16 | expect(result.length).toEqual(items.length); 17 | for (var i = 0; i < result.length; i++){ 18 | expect(result[i].firstChild.nodeValue).toEqual('' + items[i]); 19 | } 20 | }; 21 | 22 | it('should match by index', function(){ 23 | shouldSelect(':nth-child(0)', []); 24 | shouldSelect(':nth-child(1)', [1]); 25 | shouldSelect(':nth-child(10)', [10]); 26 | shouldSelect(':nth-child(11)', []); 27 | }); 28 | if (!global.disableNegNth) 29 | it('should match by index with negative', function(){ 30 | shouldSelect(':nth-child(-1)', []); 31 | }); 32 | it('should match even', function(){ 33 | shouldSelect(':nth-child(even)', [2, 4, 6, 8, 10]); 34 | }); 35 | it('should match odd', function(){ 36 | shouldSelect(':nth-child(odd)', [1, 3, 5, 7, 9]); 37 | }); 38 | it('should select no elements', function(){ 39 | shouldSelect(':nth-child(-n)', []); 40 | shouldSelect(':nth-child(4n+100)', []); 41 | }); 42 | it('should select all elements', function(){ 43 | shouldSelect(':nth-child(n)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); 44 | shouldSelect(':nth-child(-n+100)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); 45 | }); 46 | it('should skip a number of first elements', function(){ 47 | shouldSelect(':nth-child(2n+5)', [5, 7, 9]); 48 | shouldSelect(':nth-child(n+8)', [8, 9, 10]); 49 | }); 50 | if (!global.disableNegNth) 51 | it('should skip a number of last elements', function(){ 52 | shouldSelect(':nth-child(-2n+5)', [1, 3, 5]); 53 | shouldSelect(':nth-child(-4n+2)', [2]); 54 | shouldSelect(':nth-child(-n+2)', [1, 2]); 55 | }); 56 | it('should work with multiple nth-child selectors', function(){ 57 | shouldSelect(':nth-child(2n):nth-child(3n+1)', [4, 10]); 58 | shouldSelect(':nth-child(n+3):nth-child(-n+5)', [3, 4, 5]); 59 | }); 60 | it('should work with both nth-child and nth-last-child', function(){ 61 | shouldSelect(':nth-child(odd):nth-last-child(odd)', []); 62 | }); 63 | }); 64 | }; 65 | -------------------------------------------------------------------------------- /test/slick/specs/syntax.js: -------------------------------------------------------------------------------- 1 | var TAGS = 'normal UPCASE escaped\\,character \u01dd\u0070\u006f\u0254\u0131\u0075\u006e'.split(' '); 2 | 3 | var IDS = "normal escaped\\,character \u01dd\u0070\u006f\u0254\u0131\u0075\u006e with-dash with_underscore number123 silly\\:id\\:\\:with\\:colons".split(' '); 4 | 5 | var CLASSES = "normal escaped\\,character \u01dd\u0070\u006f\u0254\u0131\u0075\u006e \u7021 with-dash with_underscore number123 MiXeDcAsE".split(' '); 6 | 7 | var ATTRIB_OPERATORS = '= != *= ^= $= ~= |='.split(' '); 8 | 9 | var ATTRIB_KEYS = '\ 10 | normal,\ 11 | spaced,\ 12 | spaced ,\ 13 | escaped\\]character,\ 14 | \u01dd\u0070\u006f\u0254\u0131\u0075\u006e,\ 15 | with-dash,\ 16 | with_underscore,\ 17 | number123,\ 18 | '.split(','); 19 | 20 | var ATTRIB_VALUES = '\ 21 | normal,\ 22 | \u01dd\u0070\u006f\u0254\u0131\u0075\u006e,\ 23 | "double quote",\ 24 | \'single quote\',\ 25 | "double\\"escaped",\ 26 | \'single\\\'escaped\',\ 27 | spaced,\ 28 | spaced ,\ 29 | "spaced",\ 30 | \'spaced\',\ 31 | "spaced" ,\ 32 | \'spaced\' ,\ 33 | parens(),\ 34 | curly{},\ 35 | "quoted parens()",\ 36 | "quoted curly{}",\ 37 | "quoted square[]",\ 38 | '.split(','); 39 | // TODO: add "square[]" to ATTRIB_VALUES for prototype support 40 | 41 | var PSEUDO_KEYS = 'normal escaped\\,character \u01dd\u0070\u006f\u0254\u0131\u0075\u006e with-dash with_underscore'.split(' '); 42 | 43 | var PSEUDO_VALUES = 'normal,\u01dd\u0070\u006f\u0254\u0131\u0075\u006e, spaced,"double quote",\'single quote\',"double\\"escaped",\'single\\\'escaped\',curly{},square[],"quoted parens()","quoted curly{}","quoted square[]"'.split(','); 44 | 45 | var COMBINATORS = (" >+~" + "`!@$%^&={}\\;'); 41 | 42 | it_should_find(3 , ':root camelCasedTag'); 43 | 44 | it_should_find(3 , '[tabindex]'); 45 | it_should_find(2 , 'el[tabindex="0"]'); 46 | it_should_find(1 , 'el[tabindex="1"]'); 47 | 48 | }); 49 | 50 | }; 51 | -------------------------------------------------------------------------------- /test/slick/user-specs/pseudos.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | template xhtml as html 8 | 9 | 10 | 11 | 22 | 23 | 24 |
Should become green onclick
25 |
Shouldn't become green onclick
26 | Should become green onclick 27 | 28 | 29 | 44 | 45 | -------------------------------------------------------------------------------- /test/speed/assets/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010-2012 Mathias Bynens 2 | Based on JSLitmus.js, copyright Robert Kieffer 3 | Modified by John-David Dalton 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /test/speed/engines/nwmatcher.js: -------------------------------------------------------------------------------- 1 | nwmatcher-noqsa.js -------------------------------------------------------------------------------- /test/speed/engines/nwsapi.js: -------------------------------------------------------------------------------- 1 | ../../../src/nwsapi.js -------------------------------------------------------------------------------- /test/speed/engines/qsa.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var fake_qsa = 0; 3 | })(); 4 | -------------------------------------------------------------------------------- /test/speed/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NWSAPI Benchmark Tool 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |

NWSAPI Benchmark Tool

15 |
16 | 17 |
18 |
19 | 20 | 21 |
22 |
23 |
24 |
    25 |
  • Every selector engine gets its own isolated iframe
  • 26 |
  • Each iframe is destroyed and reset after being used
  • 27 |
  • Tests are performed on a copy of W3C Selectors page
  • 28 |
  • Based on ideas & concepts seen in Mootools Slickspeed
  • 29 |
  • Uses the awesome Benchmark.js benchmarking library
  • 30 |
31 |
32 |
33 |
34 | 35 | 36 | 37 |
38 |

Colors Legend

39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
faster selectionslower selectionexception throwndifferent result
    
53 |
 
54 |
55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /test/w3c-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | path=`dirname $0` 4 | 5 | # start an instance the php7 internal httpd server 6 | # needed to execute the w3c tests in a browser 7 | 8 | php -S localhost:8000 -t ${path}/w3c/ & 9 | 10 | -------------------------------------------------------------------------------- /test/w3c/css/selectors/attribute-selectors/attribute-case/resources/semantics-quirks.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /test/w3c/css/selectors/attribute-selectors/attribute-case/resources/semantics-xml.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/css/selectors/attribute-selectors/attribute-case/resources/syntax-quirks.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 6 | -------------------------------------------------------------------------------- /test/w3c/css/selectors/attribute-selectors/attribute-case/resources/syntax-xml.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/w3c/css/selectors/child-indexed-pseudo-class.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Matching of child-indexed pseudo-classes 4 | 5 | 6 | 7 | 8 | 56 | -------------------------------------------------------------------------------- /test/w3c/css/selectors/missing-right-token.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Selectors: attribute selectors with missing right token 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 |
20 | 21 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/w3c/dom/nodes/Element-matches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selectors-API Level 2 Test Suite: HTML with Selectors Level 3 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
This test requires JavaScript.
14 | 15 | 23 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/end-template-tag-in-body.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The file contains several </template> tag in HTML body without start one 5 | 6 | 7 | 8 | 9 |
The file contains several </template> tag in HTML body without start one
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/end-template-tag-in-head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The file contains several </template> tag in HTML head without start one 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/frameset-end-tag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The file contains frameset with the template and frameset end tag in it 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/head-template-contents-div-no-end-tag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The file contains template element with open div tag, but without end div tag, in the head 5 | 6 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/head-template-contents-table-no-end-tag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The file contains template element with open table, tr, td tags, but without end td, tr, table tags, in the head 5 | 6 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/html-start-tag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The file contains html root element with attributes and some in the body 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-child-nodes-div.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Template tag with children div tags inside 5 | 6 | 7 | 8 |

Template tag with div tags inside

9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-child-nodes-nested.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Template tag with children div tags inside another template tag 5 | 6 | 7 | 8 |

Template tag with children div tags inside another template tag

9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-attribute.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Empty template tag with attribute content 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-body.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | BODY tag inside template 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-div-no-end-tag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Div tag inside template tag 5 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-empty.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Empty template tag 5 | 6 | 7 | 8 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-frameset.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FRAMESET tag inside template 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HEAD tag inside template 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-html.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HTML tag inside template 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-nested.html: -------------------------------------------------------------------------------- 1 | 2 | Contains second template tag inside template tag 3 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-table-no-end-tag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The file contains template element with open table, tr, td tags, without end td, tr, table tags 5 | 6 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents-text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Some text inside template tag 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-contents.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Div tag inside template tag 5 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-descendant-body.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Div tag inside template tag 5 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-descendant-frameset.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Template tag inside frameset 5 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/template-descendant-head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Template tag inside head 5 | 6 | 9 | 10 | 11 | Nothing interesting here 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/scripting-1/the-template-element/resources/two-templates.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The file contains two template elements 5 | 6 | 7 | 8 | 11 | 12 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/checked-001-manual.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CSS Selectors (:checked) 5 | 6 | 7 | 10 | 11 | 12 |

Anything that is checked below should be blue.

13 |

X

14 |

X X

15 |

16 |

17 | 18 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/checked-type-change.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-class :checked input type change 4 | 5 | 6 | 7 | 8 | 12 | 13 | This text should be green. 14 | 25 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/checked.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:checked) 4 | 5 | 6 | 7 | 8 | 9 |
10 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |

23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 | 33 | 45 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:default) 4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 | 12 | 13 |
14 |
15 | 16 | 17 |
18 | 19 |
20 | 21 |
22 | 23 |
24 | 25 | 26 |
27 |
28 | 29 | 30 |
31 |
32 | 33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 45 | 46 | 47 | 48 |
49 | 50 | 51 |
52 |
53 | 54 | 55 |
56 | 57 | 58 | 65 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/dir.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Selector: pseudo-classes (:dir(ltr), :dir(rtl)) 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 |
18 | WERBEH 19 | HEBREW 20 | HEBREW 21 | WERBEH 22 | HEBREW 23 | إيان 24 | WERBEH 25 | WERBEH 26 | HEBREW 27 | ‮WERBEH‬ 28 | WERBEH 29 | HEBREW 30 | HEBREW 31 | إيان 32 | עברית 33 | 34 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/dir01.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:dir(ltr), :dir(rtl)) in iso-8859-8 documents 4 | 5 | 6 | 7 | 8 | 9 |
10 |
This text is left to right
this is right to left
11 |
This text is left to rightthis is left to right
12 | 13 | 19 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/enabled.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:enabled) 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 28 | 29 | 30 |
31 |

32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 | 41 | 44 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/focus-autofocus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:focus for autofocus) 4 | 5 | 6 | 7 | 8 | 9 | 10 | 24 | 25 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/focus-iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:focus) 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/focus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:focus) 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
hello
18 |
content
19 | 20 | 21 | 51 | 52 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/indeterminate-radio.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | :indeterminate and input type=radio 4 | 5 | 6 | 14 | 15 |
16 | 17 | 27 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/indeterminate-type-change.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-class :indeterminate input type change 4 | 5 | 6 | 7 | 8 | 12 | 13 | This text should be green. 14 | 25 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/indeterminate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:indeterminate) 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 38 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/inrange-outofrange-type-change.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:in-range, :out-of-range) input type change 4 | 5 | 6 | 7 | 8 | 19 | 20 | This text should be green. 21 | 22 | This text should be green. 23 | 44 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/link.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:link) 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/placeholder-shown-type-change.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-class :placeholder-shown input type change 4 | 5 | 6 | 7 | 8 | 16 | 17 | This text should be green. 18 | 28 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/readwrite-readonly-type-change.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:read-write, :read-only) input type change 4 | 5 | 6 | 7 | 8 | 20 | 21 | This text should be green on lime background. 22 | 37 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/required-optional-hidden.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:required, :optional) for hidden input 4 | 5 | 6 | 7 | 8 | 20 | 21 | This text should be green on lime background. 22 | 37 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/required-optional.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selector: pseudo-classes (:required, :optional) 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 17 | 21 | 22 | 23 | 24 | 36 | -------------------------------------------------------------------------------- /test/w3c/html/semantics/selectors/pseudo-classes/utils.js: -------------------------------------------------------------------------------- 1 | function getElementsByIds(ids) { 2 | var result = []; 3 | ids.forEach(function(id) { 4 | result.push(document.getElementById(id)); 5 | }); 6 | return result; 7 | } 8 | 9 | function testSelectorIdsMatch(selector, ids, testName) { 10 | test(function(){ 11 | var elements = document.querySelectorAll(selector); 12 | assert_array_equals(elements, getElementsByIds(ids)); 13 | }, testName); 14 | } 15 | 16 | function testSelectorElementsMatch(selector, elements, testName) { 17 | test(function(){ 18 | assert_array_equals(document.querySelectorAll(selector), elements); 19 | }, testName); 20 | } 21 | -------------------------------------------------------------------------------- /test/w3c/html/syntax/parsing/template/additions-to-foster-parenting/template-is-a-foster-parent-element.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HTML Templates: Template is a foster parent element 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /test/w3c/html/syntax/parsing/template/additions-to-foster-parenting/template-is-not-a-foster-parent-element.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HTML Templates: Template is not a foster parent element 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /test/w3c/html/syntax/parsing/template/additions-to-the-in-body-insertion-mode/start-tag-html.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HTML Templates: In body insertion mode: A start tag whose tag name is html 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/w3c/jsdom/dom/nodes/DocumentFragment-getElementById.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | DocumentFragment.prototype.getElementById 4 | 5 | 6 | 7 | 8 | 9 | 10 | 21 | 22 | 63 | -------------------------------------------------------------------------------- /test/w3c/jsdom/dom/nodes/Node-cloneNode-svg.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Cloning of SVG elements and attributes 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 64 | -------------------------------------------------------------------------------- /test/w3c/jsdom/dom/nodes/querySelector.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | DocumentFragment.prototype.getElementById 4 | 5 | 6 | 7 | 8 | 9 | 10 | 30 | -------------------------------------------------------------------------------- /test/w3c/jsdom/dom/nodes/svg-template-querySelector.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | querySelector on template fragments with SVG elements 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 30 | -------------------------------------------------------------------------------- /test/w3c/jsdom/svg/element.html: -------------------------------------------------------------------------------- 1 | 2 | SVGSVGElement interface 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 68 | -------------------------------------------------------------------------------- /test/w3c/jsdom/svg/svganimatedstring.html: -------------------------------------------------------------------------------- 1 | 2 | SVGAnimatedString interface 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 43 | -------------------------------------------------------------------------------- /test/w3c/resources/LICENSE: -------------------------------------------------------------------------------- 1 | W3C 3-clause BSD License 2 | 3 | http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of works must retain the original copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the original copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the W3C nor the names of its contributors may be 17 | used to endorse or promote products derived from this work without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /test/w3c/resources/nwsapi.js: -------------------------------------------------------------------------------- 1 | ../../../src/nwsapi.js -------------------------------------------------------------------------------- /test/w3c/resources/readme.md: -------------------------------------------------------------------------------- 1 | # Resources 2 | 3 | ## `testharness.js` 4 | 5 | `testharness.js` is a framework for writing low-level tests of 6 | browser functionality in javascript. It provides a convenient API for 7 | making assertions and is intended to work for both simple synchronous 8 | tests, and tests of asynchronous behaviour. 9 | 10 | ### Getting started 11 | 12 | To use `testharness.js` you must include two scripts, in the order given: 13 | 14 | ``` html 15 | 16 | 17 | ``` 18 | 19 | ### Full documentation 20 | 21 | For detailed API documentation please visit [http://web-platform-tests.org/writing-tests/testharness-api.html](http://web-platform-tests.org/writing-tests/testharness-api.html). 22 | 23 | ### Tutorials 24 | 25 | You can also read a tutorial on 26 | [Using testharness.js](http://darobin.github.com/test-harness-tutorial/docs/using-testharness.html). 27 | -------------------------------------------------------------------------------- /test/w3c/resources/testharness.css.headers: -------------------------------------------------------------------------------- 1 | Content-Type: text/css;charset=utf-8 2 | Cache-Control: max-age=3600 3 | -------------------------------------------------------------------------------- /test/w3c/resources/testharness.js.headers: -------------------------------------------------------------------------------- 1 | Content-Type: text/javascript; charset=utf-8 2 | Cache-Control: max-age=3600 3 | -------------------------------------------------------------------------------- /test/w3c/resources/testharnessreport.js: -------------------------------------------------------------------------------- 1 | /* global add_completion_callback */ 2 | /* global setup */ 3 | 4 | /* 5 | * This file is intended for vendors to implement code needed to integrate 6 | * testharness.js tests with their own test systems. 7 | * 8 | * Typically test system integration will attach callbacks when each test has 9 | * run, using add_result_callback(callback(test)), or when the whole test file 10 | * has completed, using 11 | * add_completion_callback(callback(tests, harness_status)). 12 | * 13 | * For more documentation about the callback functions and the 14 | * parameters they are called with see testharness.js 15 | */ 16 | 17 | function dump_test_results(tests, status) { 18 | var results_element = document.createElement("script"); 19 | results_element.type = "text/json"; 20 | results_element.id = "__testharness__results__"; 21 | var test_results = tests.map(function(x) { 22 | return {name:x.name, status:x.status, message:x.message, stack:x.stack} 23 | }); 24 | var data = {test:window.location.href, 25 | tests:test_results, 26 | status: status.status, 27 | message: status.message, 28 | stack: status.stack}; 29 | results_element.textContent = JSON.stringify(data); 30 | 31 | // To avoid a HierarchyRequestError with XML documents, ensure that 'results_element' 32 | // is inserted at a location that results in a valid document. 33 | var parent = document.body 34 | ? document.body // is required in XHTML documents 35 | : document.documentElement; // fallback for optional in HTML5, SVG, etc. 36 | 37 | parent.appendChild(results_element); 38 | } 39 | 40 | add_completion_callback(dump_test_results); 41 | 42 | /* If the parent window has a testharness_properties object, 43 | * we use this to provide the test settings. This is used by the 44 | * default in-browser runner to configure the timeout and the 45 | * rendering of results 46 | */ 47 | try { 48 | if (window.opener && "testharness_properties" in window.opener) { 49 | /* If we pass the testharness_properties object as-is here without 50 | * JSON stringifying and reparsing it, IE fails & emits the message 51 | * "Could not complete the operation due to error 80700019". 52 | */ 53 | setup(JSON.parse(JSON.stringify(window.opener.testharness_properties))); 54 | } 55 | } catch (e) { 56 | } 57 | // vim: set expandtab shiftwidth=4 tabstop=4: 58 | -------------------------------------------------------------------------------- /test/w3c/resources/testharnessreport.js.headers: -------------------------------------------------------------------------------- 1 | Content-Type: text/javascript; charset=utf-8 2 | Cache-Control: max-age=3600 3 | -------------------------------------------------------------------------------- /test/working-tests-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Selectors-API Test Suite: XHTML 5 | 6 | 7 | 8 | 9 |

Latest test suites

10 | 14 | 15 |

Mixed standalone tests

16 | 20 | 21 |

Older test suites

22 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/wpt/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dperini/nwsapi/0f9497ccc0268ae6d8c6ec6260c738d5ea851189/test/wpt/favicon.ico -------------------------------------------------------------------------------- /test/wpt/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/wpt/router.php: -------------------------------------------------------------------------------- 1 | 19 | -------------------------------------------------------------------------------- /test/wpt/wpt-helper.js: -------------------------------------------------------------------------------- 1 | // ==================================================================== 2 | 3 | var stateObj = { 'start': 'nw' }; 4 | 5 | if (window.location.hash == '') { 6 | window.history.replaceState(stateObj, 'nwsapi', '#nw' ); 7 | } 8 | 9 | //NW.Dom.install(true); 10 | 11 | function handleState(e) { 12 | if ((e.ctrlKey && e.altKey) || e.type == 'keypress') { 13 | switch (window.location.hash) { 14 | case '#nw': 15 | window.history.replaceState(stateObj, 'w3capi', '#w3' ); 16 | window.location.hash = '#w3'; 17 | NW.Dom.uninstall(true); 18 | break; 19 | case '#w3': 20 | window.history.replaceState(stateObj, 'nwsapi', '#nw' ); 21 | window.location.hash = '#nw'; 22 | NW.Dom.install(true); 23 | break; 24 | default: 25 | break; 26 | } 27 | } 28 | } 29 | 30 | handleState({ type: 'keypress' }); 31 | 32 | window.addEventListener('keypress', handleState); 33 | 34 | // ===== END: nwsapi seamless integration plugin for wpt testing ====== 35 | -------------------------------------------------------------------------------- /test/wpt/wpt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | path=`dirname $0` 4 | 5 | # 6 | # NOTE: All this is preliminary work in progress. 7 | # 8 | # Both wpt and nwsapi repositories must be installed 9 | # side by side at the same folder level to have them 10 | # work together smoothly as intended for these tests. 11 | # 12 | # A working instance of PHP is needed to setup the 13 | # local server, then from the main nwsapi folder 14 | # execute the provided shell to setup for testing 15 | # using the following terminal command: 16 | # 17 | # test/wpt/wpt.sh 18 | # 19 | # this will start the PHP local server and listen 20 | # for browser connections on port 8000, after this 21 | # you should be able to open the followeing URL: 22 | # 23 | # http://localhost:8000 24 | # 25 | # After loading one of the tests, you willl have the 26 | # option to execute it using the browser internal QS 27 | # API or nwsapi alternatedly by pressing the reload 28 | # button (CTRL-R in browsers), or the RERUN button 29 | # found in each of the test pages itself. 30 | # 31 | # Each reload will change the environment used 32 | # from browser intrernal QS api to nwsapi 33 | # 34 | 35 | cp ./test/wpt/favicon.svg ../wpt/ 36 | cp ./test/wpt/index.html ../wpt/ 37 | 38 | # start an instance of the PHP internal httpd server 39 | # needed to interactively execute WPT tests in browsers 40 | 41 | php -S localhost:8000 -t ../wpt/ ./test/wpt/router.php 42 | -------------------------------------------------------------------------------- /test/xml/jsdom/svg-test.js: -------------------------------------------------------------------------------- 1 | const { JSDOM } = require("jsdom"); 2 | 3 | let jsdom = new JSDOM(''); 4 | let dom = jsdom.window.document; 5 | 6 | let el = dom.querySelectorAll('[*|href]'); 7 | 8 | if (el.length === 1) { 9 | console.log('Passed!'); 10 | } else { 11 | console.log('Failed!'); 12 | } 13 | 14 | console.log(el); 15 | 16 | el = dom.querySelectorAll('[xlink:href=foo]'); 17 | 18 | console.log(el); 19 | -------------------------------------------------------------------------------- /test/xml/jsdom/xml-test.js: -------------------------------------------------------------------------------- 1 | const { JSDOM } = require("jsdom"); 2 | 3 | let jsdom = new JSDOM(); 4 | 5 | let parser = new jsdom.window.DOMParser(); 6 | let string = ``; 7 | 8 | let dom = parser.parseFromString(string, 'text/xml'); 9 | let el = dom.querySelectorAll('coreProperties'); 10 | 11 | if (el.length === 1) { 12 | console.log('Passed!'); 13 | } else { 14 | console.log('Failed!'); 15 | } 16 | 17 | console.log(el); 18 | -------------------------------------------------------------------------------- /test/xml/svg-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | SVG namespace: attribute selector test 7 | 8 | 9 | 10 | 11 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/xml/xml-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | XML namespace: tag selector test 6 | 7 | 8 | 9 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/xml/xml-test2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test case 6 | 7 | 8 | 9 | 30 | 31 | 32 | --------------------------------------------------------------------------------