Skip to content

My attempt to write a simple selector engine in Javascript.

Notifications You must be signed in to change notification settings

arti040/sillyctor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sillyctor.js

Introduction

This is a simple selector engine, for educational purpose ONLY.

The package contains 4 files:

  • test.html contains the HTML sillyctor.js will be tested on
  • test.js contains a function which will provide results for sillyctor.js in the developer console
  • sillyctor.js script
  • sillyctor-bad.js script - the very first and VERY bad approach ;-)

Running the test

Open test.html in a web browser (IE8+, Chrome, Firefox or Safari) and check the developer console for the test results. The template sillyctor.js should show 1 of 7 tests passed (as one of the answers should be an empty array)

The following calls to sillyctor.js will be made. Function should return an array of DOM elements that match the CSS selector:

  • $("div") - Should return 2 DIVs
  • $("img.some_class") - Should return 1 IMG
  • $("#some_id") - Should return 1 DIV
  • $(".some_class") - Should return 1 DIV and 1 IMG
  • $("input#some_id") - Should return an empty array
  • $("div#some_id.some_class") - Should return 1 DIV
  • $("div.some_class#some_id") - Should return 1 DIV

About

My attempt to write a simple selector engine in Javascript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published