mQuery

mQuery is a library that focuses on dom or document manipulation. It is very similar to jQuery and in many respects it is a slimmed down version of it, but at 4% the size. (2.8kB/87.6kB)

mQuery can achieve this smaller size, by giving up a lot of the backwards compatibility that is rarely needed anymore. mQuery also gives up some of the features of jQuery and only focuses on what is commonly used. However, it does have a few new features that jQuery doesn't.

Github

.size()

console.log(
    _('body').size()
) 
// output: {w: 100, h: 100}
    				

.classAdd()

_('div').classAdd('bg-red', 'txt-black')

.classRemove()

_('div').classRemove('bg-red')

.classToggle()

_('div').classToggle('bg-red')

.classContains()

_('div').classContains('bg-red')

.style()

_('div').style('background','red')

.html()

_('div').html('Rewrite HTML')

.htmlAppend()

_('div').htmlAppend('Add to end.')

.htmlPrepend()

_('div').htmlPrepend('Add to beginning.')

.htmlReplace()

<span>Hello World</span>
<script>
    _('span').htmlReplace('World','Dude')
</script>

.htmlFetch()

_('div').htmlFetch('asdfasdfasdfasdf')

.remove()

_('div').remove()

.attr()

_('div').attr('data-index', '10492')

.attrRemove()

_('div').attrRemove('data-index')

.attrToggle()

_('div').attrToggle('data-index')

.event()

_('div').evvent('click',()=>{}')

.parseForm()

console.log(
    _('form').parseForm()
};