DOM helpers extensions add a set of useful plugins for the DOM. They are described in the following sections.
The $.cookie
plugin contains useful methods to manage cookies.
Let's paste the following code into the jquerymx_cookie.js
file:
steal( 'jquery/dom/cookie', function ($) { } );
We can create a cookie in the console using the following command:
$.cookie('CookieName', 'CookieValue');
In the resources tab we can see that cookie has been created.
We can get a cookie using it's cookie name, as follows:
$.cookie('CookieName');
We can also delete a cookie using the following command:
$.cookie('CookieName', null);
The $.fn.compare
plugin
compares two nodes and returns a number describing how they are positioned each together.
Let's paste following code into the jquerymx_compare.js
file:
steal( 'jquery/dom/compare', function ($) { $('body').append('<p>paragraph</p><strong>strong</strong>'); } );
In the console...