seebigs / dollar-js Goto Github PK
View Code? Open in Web Editor NEWA lighter, faster, modular, jQuery replacement
Home Page: http://seebigs.github.io/dollar-js/
License: MIT License
A lighter, faster, modular, jQuery replacement
Home Page: http://seebigs.github.io/dollar-js/
License: MIT License
Isaac says jQuery is 2x faster
<div style="--color: red; color: var(--color)">text</div>
<script>
$('div').css('--color') ; // should return "red"
$('div').css('--color','blue') ; // should change text color to blue
//without jQuery we must currently do it like this:
getComputedStyle($('div')[0]).getPropertyValue('--color') ;
$('div')[0].style.setProperty('--color','blue') ;
</script>
<div>
<div>Text</div>
<div>Text</div>
<div>Text</div>
</div>
While querying the above dom with $('div:contains("Text")')
an exception is thrown.
jQuery handles this.
Here's the exception
dollar.min.js:1 Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Element': 'div:contains("Text")' is not a valid selector.
at e (https://gitcdn.xyz/cdn/seebigs/dollar-js/83c50c0ab564cedf80fea3bb559c31c1f30ed81b/prebuilt/dollar.min.js:1:826)
at n (https://gitcdn.xyz/cdn/seebigs/dollar-js/83c50c0ab564cedf80fea3bb559c31c1f30ed81b/prebuilt/dollar.min.js:1:269)
at B.fn.init (https://gitcdn.xyz/cdn/seebigs/dollar-js/83c50c0ab564cedf80fea3bb559c31c1f30ed81b/prebuilt/dollar.min.js:1:5309)
at B (https://gitcdn.xyz/cdn/seebigs/dollar-js/83c50c0ab564cedf80fea3bb559c31c1f30ed81b/prebuilt/dollar.min.js:1:4657)
at <anonymous>:1:1
jQuery successfully adds 2 nodes to the document
jQuery('body').prepend('<div>ONE</div><div>TWO</div>')
Dollar incorrectly only adds the first one
$('body').prepend('<div>ONE</div><div>TWO</div>')
When updating a script node that was previously appended to the DOM with a url, no network request is made.
$node.attr('src', someUrl);
Observe: No network request for someUrl
is made in the browser's network tab
See example of jquery handling this: https://jsfiddle.net/w1gg6dgm/
This lack of functionality is manifested in a few different ways...
Appending a script node that already has a src attribute set never requests the file at src.
Example:
const $node = $('<script src=${url}></script>');
$('body').append($node); // should cause the script src to be loaded.... it doesn't
$(window).height()
Uncaught TypeError: Cannot read property 'defaultView' of undefined
at getStyleModern (dollar.js:1600)
at $.fn.init.$.fn.css (dollar.js:1704)
at $.fn.init.$.fn.height (dollar.js:1761)
$.utils.isElement()
$.utils.isElement(null)
Please add ajax support in order to not have to add multi able libraries to a project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.