vendor/assets/javascripts/angular-ui-ieshiv.js in angular-ui-rails-0.2.1 vs vendor/assets/javascripts/angular-ui-ieshiv.js in angular-ui-rails-0.3.2

- old
+ new

@@ -1,22 +1,43 @@ /** * AngularUI - The companion suite for AngularJS - * @version v0.2.1 - 2012-09-19 + * @version v0.3.2 - 2012-12-04 * @link http://angular-ui.github.com * @license MIT License, http://www.opensource.org/licenses/MIT */ // READ: http://docs-next.angularjs.org/guide/ie +// element tags are statically defined in order to accommodate lazy-loading whereby directives are also unknown + +// The ieshiv takes care of our ui.directives and AngularJS's ng-view, ng-include, ng-pluralize, ng-switch. +// However, IF you have custom directives that can be used as html tags (yours or someone else's) then +// add list of directives into <code>window.myCustomTags</code> + +// <!--[if lte IE 8]> +// <script> +// window.myCustomTags = [ 'yourCustomDirective', 'somebodyElsesDirective' ]; // optional +// </script> +// <script src="build/angular-ui-ieshiv.js"></script> +// <![endif]--> + (function (exports) { - var debug = window.ieShivDebug || false; + var debug = window.ieShivDebug || false, + tags = [ "ngInclude", "ngPluralize", "ngView", "ngSwitch", "uiCurrency", "uiCodemirror", "uiDate", "uiEvent", + "uiKeypress", "uiKeyup", "uiKeydown", "uiMask", "uiMapInfoWindow", "uiMapMarker", "uiMapPolyline", + "uiMapPolygon", "uiMapRectangle", "uiMapCircle", "uiMapGroundOverlay", "uiModal", "uiReset", + "uiScrollfix", "uiSelect2", "uiShow", "uiHide", "uiToggle", "uiSortable", "uiTinymce" + ]; + window.myCustomTags = window.myCustomTags || []; // externally defined by developer using angular-ui directives + tags.push.apply(tags, window.myCustomTags); + var getIE = function () { // Returns the version of Internet Explorer or a -1 // (indicating the use of another browser). var rv = -1; // Return value assumes failure. - if (navigator.appName === 'Microsoft Internet Explorer') { + if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})"); if (re.exec(ua) !== null) { rv = parseFloat(RegExp.$1); } @@ -40,41 +61,13 @@ result.push("data-" + ns + "-" + dirname); return result; }; var shiv = function () { - // TODO: unfortunately, angular is not exposing these in 'ng' module - var tags = [ 'ngInclude', 'ngPluralize', 'ngView', 'ngSwitch' ]; // angular specific, - - // TODO: unfortunately, angular does not expose module names, it is a simple change to angular's loader.js - // however, not sure if something happens when referencing them, so maybe an OK thing. - - var moduleNames = window.myAngularModules || []; // allow user to inject their own directives - moduleNames.push('ui.directives'); - - if (debug) console.log('moduleNames', moduleNames); - function pushDirectives(item) { - // only allow directives - if (item[1] === "directive") { - var dirname = item[2][0]; - tags.push(dirname); - } else { - if (debug) console.log("skipping", item[1], item[2][0]); - } - } - - for (var k = 0, mlen = moduleNames.length; k < mlen; k++) { - var modules = angular.module(moduleNames[k]); // will throw runtime exception - angular.forEach(modules._invokeQueue, pushDirectives); - } - - if (debug) console.log("tags found", tags); for (var i = 0, tlen = tags.length; i < tlen; i++) { - if (debug) console.log("tag", tags[i]); var customElements = toCustomElements(tags[i], ':'); for (var j = 0, clen = customElements.length; j < clen; j++) { var customElement = customElements[j]; - if (debug) console.log("shivving", customElement); document.createElement(customElement); } } }; \ No newline at end of file