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

Merging of class attribute in directives crashes if class attribute is not set on the original element #1006

Closed
@maxmart

Description

@maxmart

During the work of 1.0.0.rc2, the directive handling was probably rewritten. Support seems to have been added for merging class attributes when replacing an element: f49eaf8

But if the original element does not have a class attribute, attr[name] will be undefined and the $interpolate function will crash on length = text.length at line 4644 in angular-1.0.0rc10.js (I don't have the src-files in front of me)

The simplest solution is probably to change the if-clause in addAttrInterpolateDirective function from
if (name === 'class') {
to
if (name === 'class' && attr[name]) {

I'll probably request a pull for that in a few hours if I find the time :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions