• Jump To … +
    breakpoints.js date-parse.js jquery.breakpoints.js jquery.calcRestrainedPos.js jquery.clientRect.js jquery.contentSize.js jquery.cookies.js jquery.css.js jquery.customEvent.js jquery.delimitedString.js jquery.disableEvent.js jquery.hostIframe.js jquery.hoverDelay.js jquery.htmlEncode.js jquery.imageSize.js jquery.isVisibleKeyCode.js jquery.menu.js jquery-menu-exampleskin.js jquery.modalDialog.deviceFixes.js jquery.modalDialog.getSettings.js jquery.modalDialog.header.js jquery.modalDialog.history.js jquery.modalDialog.js jquery.modalDialog.unobtrusive.js jquery.modalDialog.userAgent.js jquery.modalDialogContent.header.js jquery.modalDialogContent.js jquery.msAjax.js jquery.ns.js jquery.partialLoad.js jquery.postMessage.js jquery.proxyAll.js jquery.queryString.js jquery.richTooltip.js jquery.scrollAnchor.js jquery.uncomment.js jquery.url.js pointy.gestures.js pointy.js
  • jquery.css.js

  • ¶

    /

    (function ($) {
        var _mapCamelToDash = {};
  • ¶

    Takes a css property in object syntax (i.e. “textAlign”) and converts it to CSS string syntax (i.e. “text-align”)

        $.camelToDashCase = function (prop) {
  • ¶

    Cache for performance- big win.

            var value = _mapCamelToDash[prop];
            if (!value) {
                value = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
                _mapCamelToDash[prop] = value;
            }
    
            return value;
        };
    
        var _mapDashToCamel = {};
  • ¶

    Takes a css property in css syntax (i.e. “text-align”) and converts it to object syntax (i.e. “textAlign”)

        $.dashToCamelCase = function (sProperty) {
            var value = _mapDashToCamel[sProperty];
  • ¶

    Cache for performance: big win

            if (!value) {
                if (sProperty.indexOf("-") != -1) {
  • ¶

    convert hyphen-case to camelCase

                    var aOut = [];
                    for (var i = 0, len = sProperty.length; i < len; ++i) {
                        var sChar = sProperty.charAt(i);
                        if (sChar == "-") {
                            i++;
                            sChar = sProperty.charAt(i).toUpperCase();
                            aOut.push(sChar);
                        } else {
                            aOut.push(sChar);
                        }
                    }
    
                    value = aOut.join("");
                } else {
                    value = sProperty;
                }
    
                _mapDashToCamel[sProperty] = value;
            }
    
            return value;
        };
    
        var cssKeyEncoder = function (s) {
            return $.trim($.camelToDashCase(s)); // trim
        };
    
        var cssKeyDecoder = function (s) {
            return $.trim($.dashToCamelCase(s)); // trim
        };
    
        $.encodeCssString = function (data) {
            return $.encodeDelimitedString(data, ";", ":", cssKeyEncoder, $.trim);
        };
    
        $.parseCssString = function (cssString) {
            return $.parseDelimitedString(cssString, ";", ":", cssKeyDecoder, $.trim);
        };
    
    })(jQuery);