Chico UI - Doc

v1.0.0

Namespace util

Description

Provides varies utilities and commons functions that are used across all widgets.

Properties

.is$

Determines if a specified element is an instance of $.

ch.util.is$($('element')); // true

.isArray

Returns true if an object is an array, false if it is not.

ch.util.isArray([1, 2, 3]); // true

.VENDOR_PREFIX String

Reference to the vendor prefix of the current browser.

ch.util.VENDOR_PREFIX === 'webkit';

.zIndex Number

zIndex values.

ch.util.zIndex += 1;

Methods

.avoidTextSelection(jQuery)



    

Adds CSS rules to disable text selection highlighting.

  • jQuery - jQuerySelector : or Zepto Selector to disable text selection highlighting.
ch.util.avoidTextSelection($(selector));

.clone(obj) → {Object}



    

Returns a shallow-copied clone of the object.

  • obj - Object : The object to copy.
ch.util.clone(object);

.getOffset() → {Object}



    

Get the current offset of an element.

ch.util.getOffset(HTMLElement);

.getOuterDimensions() → {Object}



    

Get the current outer dimensions of an element.

ch.util.getOuterDimensions(HTMLElement);

.getScroll() → {Object}



    

Get the current vertical and horizontal positions of the scroll bar.

ch.util.getScroll();

.getStyles(el, prop) → {CSSStyleDeclaration}



    

Gives the final used values of all the CSS properties of an element.

  • el - object : The HTMLElement for which to get the computed style.
  • prop - string : The name of the CSS property to test.
ch.util.getStyles(HTMLElement, 'color'); // true

.inherits(obj, superConstructor) → {Object}



    

Inherits the prototype methods from one constructor into another. The parent will be accessible through the obj.super property.

  • obj - Function : The object that have new members.
  • superConstructor - Function : The construsctor Class.
ch.util.inherit(obj, parent);

.isUrl(url) → {Boolean}



    

Checks if the url given is right to load content.

  • url - String : The url to be checked.
ch.util.isUrl('www.chico-ui.com.ar'); // true

.prevent(event) → {Object}



    

Prevent default actions of a given event.

  • event - Event : The event ot be prevented.
ch.util.prevent(event);