Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Firefox ignores 'watch' class name in ng-class directive. #11813

Closed
joshmatz opened this issue May 5, 2015 · 6 comments
Closed

Firefox ignores 'watch' class name in ng-class directive. #11813

joshmatz opened this issue May 5, 2015 · 6 comments
Assignees
Milestone

Comments

@joshmatz
Copy link

joshmatz commented May 5, 2015

I'm not sure if this is an Angular or Firefox bug (or maybe I'm just missing something else) because no other browsers are having this problem...

But given a code snippet like:

<div ng-class="{className: true, watch: true, sympathy: true}">

Firefox will generate:

<div class="className sympathy"><div>

You can see this using the following Pen (Angular 1.3.2):
http://codepen.io/joshmatz/pen/Xbmame

@caitp
Copy link
Contributor

caitp commented May 5, 2015

firefox has a nonstandard property 'watch' in Object.prototype. Some version of this bug has been solved, please check if it's still an issue in 1.4.0

@caitp
Copy link
Contributor

caitp commented May 5, 2015

hmm, I think ngClass is still affected

@caitp caitp added this to the 1.4.x - jaracimrman-existence milestone May 5, 2015
@caitp caitp self-assigned this May 5, 2015
@caitp
Copy link
Contributor

caitp commented May 5, 2015

I've got a quick fix for this, http://plnkr.co/edit/7KYx6HKx8EeOcWUIT4gu?p=preview

caitp added a commit to caitp/angular.js that referenced this issue May 5, 2015
…type

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

Closes angular#11813
caitp added a commit to caitp/angular.js that referenced this issue May 6, 2015
…type

Previously, ngClass and ngAnimate would track the status of classes using an ordinary object.
This causes problems when class names match names of properties in Object.prototype, including
non-standard Object.prototype properties such as 'watch' and 'unwatch' in Firefox. Because of
this shadowing, ngClass and ngAnimate were unable to correctly determine the changed status
of these classes.

In orderto accomodate this patch, some changes have been necessary elsewhere in the codebase,
in order to facilitate iterating, comparingand copying objects with a null prototype, or which
:x

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

Closes angular#11813
caitp added a commit to caitp/angular.js that referenced this issue May 6, 2015
…type

Previously, ngClass and ngAnimate would track the status of classes using an ordinary object.
This causes problems when class names match names of properties in Object.prototype, including
non-standard Object.prototype properties such as 'watch' and 'unwatch' in Firefox. Because of
this shadowing, ngClass and ngAnimate were unable to correctly determine the changed status
of these classes.

In orderto accomodate this patch, some changes have been necessary elsewhere in the codebase,
in order to facilitate iterating, comparingand copying objects with a null prototype, or which
shadow the `hasOwnProperty` method

Summary:

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

Closes angular#11813
caitp added a commit to caitp/angular.js that referenced this issue May 6, 2015
…type

Previously, ngClass and ngAnimate would track the status of classes using an ordinary object.
This causes problems when class names match names of properties in Object.prototype, including
non-standard Object.prototype properties such as 'watch' and 'unwatch' in Firefox. Because of
this shadowing, ngClass and ngAnimate were unable to correctly determine the changed status
of these classes.

In orderto accomodate this patch, some changes have been necessary elsewhere in the codebase,
in order to facilitate iterating, comparingand copying objects with a null prototype, or which
shadow the `hasOwnProperty` method

Summary:

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

Closes angular#11813
caitp added a commit to caitp/angular.js that referenced this issue May 6, 2015
…type

Previously, ngClass and ngAnimate would track the status of classes using an ordinary object.
This causes problems when class names match names of properties in Object.prototype, including
non-standard Object.prototype properties such as 'watch' and 'unwatch' in Firefox. Because of
this shadowing, ngClass and ngAnimate were unable to correctly determine the changed status
of these classes.

In orderto accomodate this patch, some changes have been necessary elsewhere in the codebase,
in order to facilitate iterating, comparingand copying objects with a null prototype, or which
shadow the `hasOwnProperty` method

Summary:

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

Closes angular#11813
caitp added a commit to caitp/angular.js that referenced this issue May 6, 2015
…type

Previously, ngClass and ngAnimate would track the status of classes using an ordinary object.
This causes problems when class names match names of properties in Object.prototype, including
non-standard Object.prototype properties such as 'watch' and 'unwatch' in Firefox. Because of
this shadowing, ngClass and ngAnimate were unable to correctly determine the changed status
of these classes.

In orderto accomodate this patch, some changes have been necessary elsewhere in the codebase,
in order to facilitate iterating, comparingand copying objects with a null prototype, or which
shadow the `hasOwnProperty` method

Summary:

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

Closes angular#11813
caitp added a commit to caitp/angular.js that referenced this issue May 6, 2015
…type

Previously, ngClass and ngAnimate would track the status of classes using an ordinary object.
This causes problems when class names match names of properties in Object.prototype, including
non-standard Object.prototype properties such as 'watch' and 'unwatch' in Firefox. Because of
this shadowing, ngClass and ngAnimate were unable to correctly determine the changed status
of these classes.

In orderto accomodate this patch, some changes have been necessary elsewhere in the codebase,
in order to facilitate iterating, comparingand copying objects with a null prototype, or which
shadow the `hasOwnProperty` method

Summary:

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

Closes angular#11813
@caitp caitp closed this as completed in 364e72f May 6, 2015
caitp added a commit that referenced this issue May 6, 2015
…type

Previously, ngClass and ngAnimate would track the status of classes using an ordinary object.
This causes problems when class names match names of properties in Object.prototype, including
non-standard Object.prototype properties such as 'watch' and 'unwatch' in Firefox. Because of
this shadowing, ngClass and ngAnimate were unable to correctly determine the changed status
of these classes.

In orderto accomodate this patch, some changes have been necessary elsewhere in the codebase,
in order to facilitate iterating, comparingand copying objects with a null prototype, or which
shadow the `hasOwnProperty` method

Summary:

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

R=@matsko

Closes #11813
Closes #11814
@softsimon
Copy link

I have stumbled across this "watch" limitation at several occasions in 1.4.
I can't send a parameter called 'watch' as a POST var to ngResource, it gets ignored. I can't create a state called 'watch' in ui-router.

@caitp
Copy link
Contributor

caitp commented Jul 3, 2015

Could you file individual bugs for each issue you're running into? It's much easier to track them that way. As for this one in particular, It's been fixed

@caitp
Copy link
Contributor

caitp commented Jul 3, 2015

Not for the ui-router issue though open that on their repo

netman92 pushed a commit to netman92/angular.js that referenced this issue Aug 8, 2015
…type

Previously, ngClass and ngAnimate would track the status of classes using an ordinary object.
This causes problems when class names match names of properties in Object.prototype, including
non-standard Object.prototype properties such as 'watch' and 'unwatch' in Firefox. Because of
this shadowing, ngClass and ngAnimate were unable to correctly determine the changed status
of these classes.

In orderto accomodate this patch, some changes have been necessary elsewhere in the codebase,
in order to facilitate iterating, comparingand copying objects with a null prototype, or which
shadow the `hasOwnProperty` method

Summary:

- fast paths for various internal functions when createMap() is used
- Make createMap() safe for internal functions like copy/equals/forEach
- Use createMap() in more places to avoid needing hasOwnProperty()

R=@matsko

Closes angular#11813
Closes angular#11814
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants