KO
|
EN
gitlite — search
Search
#python
#javascript
#golang
#css
#java
#go
#typescript
#html
#fastapi
#github
#unity
#simulation
mq
★ 42
Open GitHub ↗
< 200 byte DOM manipulation
Download README (.md)
Explore Similar Repositories
sysadm
:
Official repo for TrueOS's sysadm utility and websocket server
Pino
:
Our Sailboat
font-level-up
:
WebFonts talk
scplayer
:
Open source client of Spotify Connect closed library developed in Java
botmakers.org-v1
:
A Slack community of bot makers and bot enthusiasts.
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
mq
?
Download (.md)
### mq < 200 byte DOM manipulation. #### Usage Use a single dollar sign to get a single element (first match) by CSS selector: ```js var el = $('header nav'); ``` Use a double dollar sign to get a NodeList of all elements matching the CSS selector: ```js var items = $$('header nav li'); ``` Operate directly on NodeLists using Array's `forEach` and `map` functions: ```js var items = $$('header nav li'); items.forEach(function(el) { console.log(el.innerHTML); }); ``` On a single element, use any property or function you'd normally use on an Element, HTMLElement, etc. (`addEventListener`, `innerHTML`, `classList`, `offsetTop`). #### Browser support Hard to really say, since it depends on what native methods you end up using. But mq is expected to work quite well in IE 9+ and other modern browsers (Chrome, Firefox, Safari). Open up an issue or PR if you know of anything major that doesn't work as expected across browser! #### Drawbacks - No standardization of methods/outputs (we are relying on the unreliable fact that browsers will behave in the same way). - No shortcuts #### Benefits - Tiny size - Performance - 'Standard' JavaScript — survive without needing jQuery!