API

Full API documentation.

util (Namespace)

Description

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

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(el) → {Object}



    

Get the current offset of an element.

  • el - HTMLElement : A given HTMLElement.
ch.util.getOffset(el);

.getOuterDimensions(el) → {Object}



    

Get the current outer dimensions of an element.

  • el - HTMLElement : A given HTMLElement.
ch.util.getOuterDimensions(el);

.getPositionedParent(el, position) → {HTMLElement}



    

Get the current parentNode with the given position.

  • el - HTMLElement : A given HTMLElement.
  • position - String : A given position (static, relative, fixed or absolute).
ch.util.getPositionedParent(el, 'fixed');

.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 - HTMLElement : 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);