You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
attrs defining properties that are not existent in 1.4 #12370
in <=1.3 the directives attrs object only contained those attributes that are actually defined on an element. with 1.4 the attrs contains them even when they are not defined (seems to me it looks in scope or so, but havent looked into that).
previously we could write if(attrs.myAttr){} now we have to check for undefined.
Writing if (attrs.myAttr) isn't enough, because it does an empty string still evaluates to false (i.e. the attribute may be present but you won't detect it using if (attrs.myAttr) if it has an empty value.
So, if you were using if (attrs.myAttr) then setting non-present properties to undefined does not affect your usecase.
A more consistent way to check for whether an attribute is present or not, is if (attrs.hasOwnProperty('myAttr')) (and this would indeed be affected by the new behaviour you described).
Anyway, I think this issue has been fixed recently, so could you try if it still happens on 1.4.3 ?
If it does, it would be better to post a live demo, so people can identify (and solve) the problem sooner.
Writing if (attrs.myAttr) isn't enough, because it does an empty string still evaluates to false (i.e. the attribute may be present but you won't detect it using if (attrs.myAttr) if it has an empty value.
So, if you were using if (attrs.myAttr) then setting non-present properties to undefined does not affect your usecase.
A more consistent way to check for whether an attribute is present or not, is if (attrs.hasOwnProperty('myAttr')) (and this would indeed be affected by the new behaviour you described).
Anyway, I think this issue has been fixed recently, so could you try if it still happens on 1.4.3 ?
If it does, it would be better to post a live demo, so people can identify (and solve) the problem sooner.
—
Reply to this email directly or view it on GitHub.
if (attrs.hasOwnProperty('myAttr')) this isn't super good, because there are cases where the attribute is shadowed but uninitialized. You also want to tack a && attrs.myAttr !== void 0 test, for reliability.
IIRC this is fixed (at least marginally) in one of my recent prs, but I don't think it's landed yet.
if (attrs.hasOwnProperty('myAttr')) this isn't super good, because there are cases where the attribute is shadowed but uninitialized. You also want to tack a && attrs.myAttr !== void 0 test, for reliability.
IIRC this is fixed (at least marginally) in one of my recent prs, but I don't think it's landed yet.
—
Reply to this email directly or view it on GitHub.
It used to work (without the void 0 part), but then it broke and the it was fixed, but then the fix was reverted again (because it broke ngMaterial) and then I thought it was fixed again (by @caitp's PR), but I am not 100% sure it has been merged. Fun stuff 😃
changed the title [-]attrs defining properties that are not exitant in 1.4[/-][+]attrs defining properties that are not existent in 1.4[/+]on Jul 23, 2015
Activity
gkalpak commentedon Jul 17, 2015
Writing
if (attrs.myAttr)isn't enough, because it does an empty string still evaluates to false (i.e. the attribute may be present but you won't detect it usingif (attrs.myAttr)if it has an empty value.So, if you were using
if (attrs.myAttr)then setting non-present properties toundefineddoes not affect your usecase.A more consistent way to check for whether an attribute is present or not, is
if (attrs.hasOwnProperty('myAttr'))(and this would indeed be affected by the new behaviour you described).Anyway, I think this issue has been fixed recently, so could you try if it still happens on 1.4.3 ?
If it does, it would be better to post a live demo, so people can identify (and solve) the problem sooner.
matthiasg commentedon Jul 17, 2015
Sorry we also used ownproperty but thanks I will restest
-----Original Message-----
From: "Georgios Kalpakas" notifications@github.com
Sent: 17.07.2015 19:48
To: "angular/angular.js" angular.js@noreply.github.com
Cc: "matthiasg" mgt576@gmail.com
Subject: Re: [angular.js] attrs defining properties that are not exitant in1.4 (#12370)
Writing if (attrs.myAttr) isn't enough, because it does an empty string still evaluates to false (i.e. the attribute may be present but you won't detect it using if (attrs.myAttr) if it has an empty value.
So, if you were using if (attrs.myAttr) then setting non-present properties to undefined does not affect your usecase.
A more consistent way to check for whether an attribute is present or not, is if (attrs.hasOwnProperty('myAttr')) (and this would indeed be affected by the new behaviour you described).
Anyway, I think this issue has been fixed recently, so could you try if it still happens on 1.4.3 ?
If it does, it would be better to post a live demo, so people can identify (and solve) the problem sooner.
—
Reply to this email directly or view it on GitHub.
caitp commentedon Jul 17, 2015
if (attrs.hasOwnProperty('myAttr'))this isn't super good, because there are cases where the attribute is shadowed but uninitialized. You also want to tack a&& attrs.myAttr !== void 0test, for reliability.IIRC this is fixed (at least marginally) in one of my recent prs, but I don't think it's landed yet.
matthiasg commentedon Jul 17, 2015
Thanks ! Will keep an eye out.
-----Original Message-----
From: "⭐caitp⭐" notifications@github.com
Sent: 17.07.2015 19:57
To: "angular/angular.js" angular.js@noreply.github.com
Cc: "matthiasg" mgt576@gmail.com
Subject: Re: [angular.js] attrs defining properties that are not exitant in1.4 (#12370)
if (attrs.hasOwnProperty('myAttr')) this isn't super good, because there are cases where the attribute is shadowed but uninitialized. You also want to tack a && attrs.myAttr !== void 0 test, for reliability.
IIRC this is fixed (at least marginally) in one of my recent prs, but I don't think it's landed yet.
—
Reply to this email directly or view it on GitHub.
gkalpak commentedon Jul 17, 2015
It used to work (without the
void 0part), but then it broke and the it was fixed, but then the fix was reverted again (because it brokengMaterial) and then I thought it was fixed again (by @caitp's PR), but I am not 100% sure it has been merged. Fun stuff 😃caitp commentedon Jul 17, 2015
yeah i'm pretty sure we never merged it
caitp commentedon Jul 17, 2015
#12290 still open and waiting
[-]attrs defining properties that are not exitant in 1.4[/-][+]attrs defining properties that are not existent in 1.4[/+]Narretz commentedon Jul 23, 2015
I am gonna close this as a duplicate. I am pretty confident #12290 will land this or next week.
matthiasg commentedon Jul 29, 2015
our workaround right now is
PS: without es6 we would write
filter('['+attributeName+']')of course