I’ve published today Sciter 2.0.2.2 with q.tis – micro-port of essential jQuery features.
Here is the list of supported functions.
It is just enough to put include "t.tis";
in your code and any existing DOM function that returns array of elements will
“automagically” produce the q-collection.
In my implementation I am using the fact that functions like Element.selectAll("selector")
return array object that is instanceof ElementList.
ElementList as any class is extensible in run-time. So I’ve just added bunch of function ElementList.jqueryMethod() {}
to bring that functionality to the Sciter.
The beauty of the approach is that you can use as the q()
function (analog of $()
in jQuery) as Sciter’s standard $$()
to write something like this:
var itemsWithLinks = $$(ul.topics > li).$has(a:link);
to get list of list items that have <a>’s inside.
The same but in classic style and without use of “stringizers”:
var itemsWithLinks = q("ul.topics > li").has("a:link");
You may also find handy jquery-alike event handling. Methods element.on(), element.off(), element.one() and element.trigger() are available as for q-collections as for DOM element instances.