Add the app!!!
[src/app-framework-demo.git] / afb-client / app / Frontend / services / JQueryEmu.js
diff --git a/afb-client/app/Frontend/services/JQueryEmu.js b/afb-client/app/Frontend/services/JQueryEmu.js
new file mode 100644 (file)
index 0000000..5112052
--- /dev/null
@@ -0,0 +1,42 @@
+(function () {
+    'use strict';
+
+    // _all modules only reference dependencies
+    angular.module('JQueryEmu', [])
+
+            // Factory is a singleton and share its context within all instances.
+            .factory('JQemu', function () {
+
+                // JQueryLight cannot search a tag within ancestrors
+                var parent = function (element, selector) {
+                    var parent = element;
+                    var search = selector.toUpperCase();
+                    while (parent[0]) {
+                        if (search === parent[0].tagName) {
+                            return parent;
+                        }  // HTMLDivElement properties
+                        parent = parent.parent();
+                    }
+                };
+                
+                // JQueryLight cannot search by type
+                var  findByType= function (element, selector) {
+                    var search = selector.toLowerCase();
+                    var children = element.children();
+                    while (children[0]) {
+                        if (search === children[0].type) {
+                            return children;
+                        }  // HTMLDivElement properties
+                        children = children.next();
+                    }
+                };
+
+                var myMethods = {
+                    parent: parent,
+                    findByType: findByType
+                };
+
+                return myMethods;
+            });
+
+})();
\ No newline at end of file