jQuery is an effectively created JavaScript library with a genuinely fast discharge cycle. Just as general improvements, execution changes and bug fixes, new strategies are much of the time added to the library.
THE READY EVENT WITH THE HOLDREADY() METHOD
The holdReady() strategy is utilized to defer the terminating of jQuery's prepared occasion, a foundation occasion which is prevalently used to execute custom code once the DOM is prepared to be controlled. As of jQuery 1.6 we would now be able to delay the activating of this occasion for a discretionary time allotment so as to trust that different conditions will be fulfilled, for example, the stacking of a module.
It's a double reason technique, just like the jQuery way, and can be utilized to both postpone the occasion and discharge the occasion norton.com/setup utilizing a similar straightforward mark. The technique acknowledges a Boolean contention which indicates whether the occasion ought to be held or discharged.
One drawback to this strategy is that it ought to be called as right off the bat in the record as could be allowed, for example, in the <head> of the page, and can clearly just be called after jQuery itself has stacked. As we probably am aware, for execution reasons, contents ought to more often than not be put as near the finish of the report as would be prudent, so moving jQuery to the <head> should possibly be viewed as when totally required.
Utilizing holdReady() is too simple; as from the get-go in the record stacking as conceivable essentially call the strategy with the esteem valid as the contention:
jQuery.holdReady(true);
At that point, once the extra file(s) you require have stacked, call the technique again with the esteem false:
jQuery.holdReady(false);
Including AND REMOVING ELEMENT PROPERTIES
The prop() strategy is an approach to unequivocally recover component property estimations. There is an inconspicuous contrast among properties and qualities and this distinction used to make intermittent issues while attempting get or set property estimations utilizing jQuery's attr() technique.
The great model is with checkbox components; there were now and again issues when attempting to progressively set the checked property utilizing the attr() strategy. At the point when the prop() strategy was discharged in rendition 1.6 the attr() technique was changed with the goal that it retuned just the underlying condition of the property, anyway this was changed in the 1.6.1 discharge so it additionally restores the present state when utilizing attr(). To utilize the prop() strategy we utilize indistinguishable sentence structure from with attr():
$("input[type='checkbox']).prop("checked");
The technique in this arrangement restores the present esteem. To utilize the strategy in setter mode we simply supply a second contention indicating what we might want the incentive to be.
The prop() technique can likewise be utilized to set custom properties on components, and you should take note of that the strategy just returns the property estimation for the principal component in a gathering, not every component in the accumulation.
To evacuate custom properties, the new removeProp() strategy is likewise accessible since jQuery 1.6. This technique should just be utilized to evacuate custom properties; if local properties are expelled it isn't workable for them to be re-included. Custom properties ought to dependably be evacuated before the component that they have been added to is expelled from the DOM so as to forestall memory spills in old forms of IE.
Guarantee OBJECTS
The new guarantee() technique restores a guarantee object that can be utilized to execute self-assertive code once all activities on every component in the gathering the strategy is connected to have finished. Of course the guarantee object screens fx lines, yet custom lines can likewise be determined by providing a discretionary first contention to the technique. The article that the guarantee strategies are connected to can likewise be indicated utilizing a discretionary second contention to abstain from making another item.
The strategy can be utilized related to strategies, for example, done() to execute a capacity when all livelinesss on a component have finished:
$("#animated").promise().done(function () {
/do stuff
});
A NEW SELECTOR
We would now be able to make utilization of the :center pseudo-selector to choose an engaged component, or decide if a component has center, an extraordinary new expansion that could help save money on tangled work-arounds.
NEW DEFERRED METHODS
jQuery 1.6 carries two new techniques for use with conceded items; the first is the dependably() strategy which can be utilized to execute a capacity paying little respect to whether the conceded article is settled or dismissed. The second new technique is pipe(), which can be utilized to channel conceded articles either when they resolve or come up short. The technique returns either a separated esteem which can be passed to the done() or come up short() strategies for the conceded article the pipe() strategy is appended to, or another guarantee object.
The data gave is only a speedy outline, so I'd prescribe an outing to the jQuery docs pages for additional data when utilizing any of the new strategies.
Comments
Post a Comment