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.

Having custom Object.prototype method prevents form validation #12066

Closed
@funkflute

Description

@funkflute

I'm running into this issue that if I set a custom Object.prototype method, it stops form validation from updating:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Test</title> 
    </head>
    <body ng-app>
        <form name="testForm" novalidate>
            <!-- type in here and field and form should turn valid -->
            <input type="text" name="test" ng-model="test" required> Field Valid? {{testForm.test.$valid | json}}
        </form>
        Form valid? {{testForm.$valid | json}}

        <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
        <script>
            // remove this line and validation works again
            Object.prototype.someThing = function() {}
        </script>
    </body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions