I see in the docs (https://docs.angularjs.org/api/ng/service/$compile) that replace is "DEPRECATED! ... will be removed in next major release". I assume that since the default for replace is false, that when it is in fact removed, the behavior will be the same as for replace==false. Is that the case? (wish docs were clear on this point).
Probably is.
@stevebroshar it will behave as if the replace property was not there
the next major release is not going to be even remotely compatible with the current API anyways, so...
@caitp What obviously means v2.0.0, right?
Can someone with authority explain WHY this is being removed (code efficiency, compatibility, etc) and what that means going forward... As someone who writes CSS for a living, requiring a bunch of extra nested tags is going to be difficult to work with (impossible in some cases... table tags, i'm looking at you). Also, does this mean the end of a single element with multiple directives?
@jessehouchins I don't think replace is going to be removed from 1.3. As for it being removed from 2.0, well, the entire API for 2.0 is completely different, so "removing" deprecated features doesn't make much sense there. Since we're still shipping fixes for the replace directive in 1.3, I really wouldn't worry too much about it disappearing.
It's just that it does make the compiler kind of crazy
As @caitp says, the replace:true feature causes all kinds of problems in the compiler and there are even now outstanding issues related to it that are almost impossible to fix.
The feature was added to AngularJS to get around problems with old browsers that really couldn't cope very well with custom elements, and also to help with aesthetics - clearing out unnecessary custom elements seemed like a nice thing to do.
Nowadays browsers are much more happy to have custom elements in the DOM, and with the dawn of web components this is now more and more common.
So Angular V2 will not have the ability for directives to replace themselves with their template.
This is not good news. While it may be easier to compile without replace, there are still some corners of html (I'm looking at you tables) where having extra wrapping markup is not possible. Not to mention it will force extra markup that is solely based on angular implementation which could easily break existing CSS, or at least make it necessary to handle extra edge cases.
_sad face_
Dude, relax.
First of all, replace: true doesn't help whatsoever with tables. It just doesn't. If the HTML parser is in table-mode, and it sees a tag which it doesn't think belongs in a table, it moves that tag outside of the table, before compilation ever happens. What you really need to do for table markup is use attribute directives (or class directives, but please don't do that) --- alongside tag names that the HTML parser will be happy with in a table.
Second of all, you aren't going to see replace disappear from angular 1.x (I don't know this for sure, but I'm fairly sure we won't be removing it, since it's a huge breaking change. It's deprecated, that's all).
It's deprecated because there are known, very silly problems with replace: true, a number of which can't really be fixed in a reasonable fashion. If you're careful and avoid these problems, then more power to you, but for the benefit of new users, it's easier to just tell them "this will give you a headache, don't do it".
Anyways, that's my personal take on the whole thing.
Most helpful comment
Can someone with authority explain WHY this is being removed (code efficiency, compatibility, etc) and what that means going forward... As someone who writes CSS for a living, requiring a bunch of extra nested tags is going to be difficult to work with (impossible in some cases... table tags, i'm looking at you). Also, does this mean the end of a single element with multiple directives?