aboutsummaryrefslogtreecommitdiffstats
path: root/src/Angular.js
diff options
context:
space:
mode:
authorMisko Hevery2011-11-29 12:11:32 -0800
committerMisko Hevery2012-01-25 11:46:36 -0800
commit8af4fde18246ac1587b471a549e70d5d858bf0ee (patch)
tree925e223c9221c8e3b40ff3fb5cade11b819782d5 /src/Angular.js
parent5001c1a1217772d2bffe108bafd475b24badf559 (diff)
downloadangular.js-8af4fde18246ac1587b471a549e70d5d858bf0ee.tar.bz2
add($compile): add compiler v2.0 - not connected
Diffstat (limited to 'src/Angular.js')
-rw-r--r--src/Angular.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 17ede3aa..4a0589c3 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -627,6 +627,22 @@ function copy(source, destination){
}
/**
+ * Create a shallow copy of an object
+ * @param src
+ */
+function shallowCopy(src) {
+ var dst = {},
+ key;
+ for(key in src) {
+ if (src.hasOwnProperty(key)) {
+ dst[key] = src[key];
+ }
+ }
+ return dst;
+}
+
+
+/**
* @ngdoc function
* @name angular.equals
* @function
@@ -750,6 +766,19 @@ function toBoolean(value) {
return value;
}
+/**
+ * @returns {string} Returns the string representation of the element.
+ */
+function startingTag(element) {
+ element = jqLite(element).clone();
+ try {
+ // turns out IE does not let you set .html() on elements which
+ // are not allowed to have children. So we just ignore it.
+ element.html('');
+ } catch(e) {};
+ return jqLite('<div>').append(element).html().replace(/\<\/[\w\:\-]+\>$/, '');
+}
+
/////////////////////////////////////////////////
@@ -918,6 +947,14 @@ function bootstrap(element, modules) {
return injector;
}
+var SNAKE_CASE_REGEXP = /[A-Z]/g;
+function snake_case(name, separator){
+ separator = separator || '_';
+ return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
+ return (pos ? separator : '') + letter.toLowerCase();
+ });
+}
+
function bindJQuery() {
// bind to jQuery if present;
jQuery = window.jQuery;
@@ -951,6 +988,7 @@ function assertArg(arg, name, reason) {
}
function assertArgFn(arg, name) {
+ assertArg(arg, name);
assertArg(isFunction(arg), name, 'not a function, got ' +
(typeof arg == 'object' ? arg.constructor.name || 'Object' : typeof arg));
return arg;