A tiny subset of jQuery - not nearly as awesome, but small. 911 B gzipped small.
As with jQuery you can pass the following things into constructor $( selector )
:
- CSS-selector
- HTML string
window
ordocument
HTMLElement
NodeList
Function
(for Document ready)johanQuery
object
On an instanciated object, you've got these methods at hand:
.find()
.each()
.map()
.add()
.filter()
.slice()
.splice()
.reverse()
.first()
.last()
.eq()
.get()
.parent()
.children()
.hasClass()
.addClass()
.removeClass()
.toggleClass()
.attr()
.data()
.append()
.prepend()
.remove()
.html()
.text()
.isHTML()
.on()
.off()
.trigger()
$(function() { alert("DOM loaded!") })
(Document ready)
This is only an experiment - me trying learning about how jQuery works. In other words do not use this in production!
window.johanQuery
and window.$
are made available if they do not already exist. To make sure that your $("#superElement")
or johanQuery("#superElement")
is actually a johanQuery
object, try $("#superElement") instanceof johanQuery
.
- Tests against jQuery
- Support second context parameter
$("selector", context)
- Support multiple events per element
- Support namespaced events
- Support data to be passed with events
- Support
.siblings()
IE 10+, Chrome, Firefox, Safari, Opera