Currently, legacy browsers get to use a clever scheme for resolving relative URIs in html5Mode,
and resolve the URI relative to $location.path().
Currently, $location.path() can be '/' under certain circumstances, which means that when we
split $location.path() on '/' and later join by '/' after adding another path component,
we end up with '//pathComponent'. $$rewrite fails to deal with this correctly, and effectively
the $location is never changed from the root path.
This CL corrects this by ensuring that the duplicate '/' situation does not occur when resolving
relative URIs.
Closes#8684
.context is a deprecated jQuery api still being used by at least live() queries, so
we need to keep it in up to date during replacement.
Because of the if check, we can be sure that we replace the context only when jQuery is being
used and the context property is set to the element being replaced.
Closes#8253Closes#7900
This reverts commit 0d608d041f.
The commits caused more breaking changes at Google than initially expected and since its
benefit is small, so it's not worth keeping.
Change jqLite's implementation of wrap() to clone the wrapNode before
wrapping the target element in it.
Match jQuery's wrap() behavior and prevent accidentally attaching
target element to the DOM as a side effect.
Closes#3860Closes#4194
The change unfortunatelly makes us incompatible with jQuery which always falls back to onLoad.
Not falling back to onLoad is a possible breaking change because if Angular was added to the document during DOMContentLoaded
document.readyState at this point is 'interactive' which we'd need to add to our check, but more importantly if more scripts
are added during DOMContentLoaded these won't be loaded before we bootstrap, which can cause angular modules not to be found
during bootstrap.
This load ordering issues is really just a cornercase that should be handled via manual bootstrap, but until jQuery has the same
behavior we shouldn't do something else.
Previously we would do it manually in all of our structural directives.
BREAKING CHANGE: element-transcluded directives now have an extra comment automatically appended to their cloned DOM
This comment is usually needed to keep track the end boundary in the event child directives modify the root node(s).
If not used for this purpose it can be safely ignored.
the previousNode was almost always correct except when we added a new block in which case incorrectly
assigned the cloned collection to the variable instead of the end comment node.
while querySelectorAll is much more expensive than getElementsByTagName on elements with
both many and few children, cloning the live node list returned by getElementsByTagName
makes it as expensive as querySelectorAll (we need to clone because we need the node list
not to change while we iterate over it).
the childNodes and childNodes.length check is as expensive as querySelectorAll on a node
without any children, so it only makes the whole lookup 2x as slow, so I'm removing it.
This is a major perf win in the large table benchmark (~100ms or 9).
This cleanup is needed only for regular transclusion because only then the DOM hierarchy doesn't match scope hierarchy
(transcluded scope is a child of the parent scope and not a child of the isolate scope)
We should consider refactoring this further for the case of regular transclusion
and consider using scope events instead.
bda673f8e7 changed code to only use `str.split()` when necessary,
but the result was that `str.split()` would always be taken unless ' ' was the first character
in the string, negating the effectiveness of the perf fix.
Closes#8648
Since we control the oldValue, we don't need to worry about proto-inhereted properties which means we can use
'for in' and skip hasOwnProperty checks.
http://jsperf.com/for-in-vs-object-keys2
doesn't make any significant impact on our current benchmarks because we don't have benchmarks with
many scope events, but this is a straightforward change worth doing
this is a micro-optimization based on http://jsperf.com/isobject4
no significant improvement in macro-benchmarks, but since it makes the code better it makes
sense making this change.