summaryrefslogtreecommitdiffstats
path: root/js/vendor/angular-ui/common/ieshiv
diff options
context:
space:
mode:
Diffstat (limited to 'js/vendor/angular-ui/common/ieshiv')
-rw-r--r--js/vendor/angular-ui/common/ieshiv/README.md47
-rw-r--r--js/vendor/angular-ui/common/ieshiv/ieshiv.js52
2 files changed, 99 insertions, 0 deletions
diff --git a/js/vendor/angular-ui/common/ieshiv/README.md b/js/vendor/angular-ui/common/ieshiv/README.md
new file mode 100644
index 000000000..0c77cec20
--- /dev/null
+++ b/js/vendor/angular-ui/common/ieshiv/README.md
@@ -0,0 +1,47 @@
+# angular-ui-ieshiv
+
+## Important!
+
+If not installed properly, angular WILL throw an exception.
+
+ "No module: ui.directives"
+
+Which means you have not included the angular-ui library in the file, or the shiv is in the wrong place.
+
+WHY? Well, angular is throwing the exception and I can't catch and stop it. If properly setup, you should be good.
+If not, then you should probably fix it or yank it out. Of course, then you won't have the shiv for ie.
+
+## Description
+
+This is used in order to support IE versions that do not support custom elements. For example:
+
+ <ng-view></ng-view>
+ <ui-currency ng-model="somenum"></ui-currency>
+
+IE 8 and earlier do not allow custom tag elements into the DOM. It just ignores them.
+In order to remedy, the trick is to tell browser by calling document.createElement('my-custom-element').
+Then you can use, <my-custom-element>...</my-custom-element>, you also may need to define css styles.
+
+In current version, this will automagically define directives found in the ui.directives module and
+angular's ngView, ngInclude, ngPluralize directives.
+
+## Usage
+
+The shiv needs to run after angular has compiled the application. Best to load angular-ui-ieshiv.js at
+bottom of <head> section.
+
+ <!--[if lte IE 8]> <script src="build/angular-ui-ieshiv.js"></script><![endif]-->
+
+### Options
+
+ There will be
+
+### Notes
+ - modules are searched for directives
+ - only IE 8 and earlier will cause shiv to run
+ - there will be a slight performance hit (for IE)
+
+### Todo
+ - provide ability to specify which directives to include/exclude
+ - automagically locate all custom directives in current ng-app (this will involve recursion)
+ \ No newline at end of file
diff --git a/js/vendor/angular-ui/common/ieshiv/ieshiv.js b/js/vendor/angular-ui/common/ieshiv/ieshiv.js
new file mode 100644
index 000000000..c34b27d36
--- /dev/null
+++ b/js/vendor/angular-ui/common/ieshiv/ieshiv.js
@@ -0,0 +1,52 @@
+// 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,
+ 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 toCustomElements = function (str) {
+ var result = [];
+ var dashed = str.replace(/([A-Z])/g, function ($1) {
+ return " " + $1.toLowerCase();
+ });
+ var tokens = dashed.split(' ');
+ var ns = tokens[0];
+ var dirname = tokens.slice(1).join('-');
+
+ // this is finite list and it seemed senseless to create a custom method
+ result.push(ns + ":" + dirname);
+ result.push(ns + "-" + dirname);
+ result.push("x-" + ns + "-" + dirname);
+ result.push("data-" + ns + "-" + dirname);
+ return result;
+ };
+
+ for (var i = 0, tlen = tags.length; i < tlen; i++) {
+ var customElements = toCustomElements(tags[i]);
+ for (var j = 0, clen = customElements.length; j < clen; j++) {
+ var customElement = customElements[j];
+ document.createElement(customElement);
+ }
+ }
+
+})(window); \ No newline at end of file