
Prevents a class from applying itself to an element that already has had the class applied.
Determines if the class has already been applied to the element.
this.occlude(property, element)
var Widget = new Class({ Implements: [Class.Occlude], initialize: function(element){ if (this.occlude('widget', element)) return this.occluded; //returns the instance already bound to the element and exits } });
See the two properties below for ideal usage.
The string used to bind the instance of the class to the element.
var Widget = new Class({ Implements: [Class.Occlude], property: 'widget', initialize: function(element){ this.element = $(element); if (this.occlude()) return this.occluded; //returns the instance already bound to the element and exits } });
In the example above, because we have a this.element property and because we define the this.property property in the class, the method occlude doesn't require any arguments as it uses these by default.
© Linux.ria.ua, 2008-2024 |