Closed Bug 1464988 Opened 7 years ago Closed 7 years ago

When HTML oninput event triggers and Firefox auto populates input fields onload of DOM, Javascript tied to it cannot be found (yet)

Categories

(Firefox :: Untriaged, defect)

61 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bernardvisagie, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0 Build ID: 20180524181234 Steps to reproduce: 1. I have an HTML(5) login page with a username and password. (Bootstrap 4+ based website) 2. I have oninput event listeners for both these inputs. Example: <input type="text" class="form-control form-control-sm" placeholder="Enter username" required="required" id="usernameInput" maxlength="50" oninput="checkSomething();"> <input type="password" class="form-control form-control-sm" placeholder="Enter password" required="required" id="passwordInput" maxlength="50" oninput="checkSomething();"> 3. For both Username and Password fields I let Firefox save previous login details. Actual results: 1. When the page is refreshed I look at inspector running Firefox developer edition 61.0b8 (64-bit) 2. Inspector picks up "ReferenceError: checkSomething is not defined[Learn More]" oninput http://localhost/testsite/index.html:1:1 _fillForm resource://gre/modules/LoginManagerContent.jsm:1240:9 loginsFound resource://gre/modules/LoginManagerContent.jsm:568:5 loginsFound self-hosted:983:17 Expected results: This is the difficult part; potentially if an auto fill event is triggered by the browser it should somehow wait / or come after some more of the DOM is loaded as if it's so quick / early the JavaScript (whether it's in the Head or Body) has not been loaded yet.
Summary: HTML oninput event seems to trigger when Firefox auto populates input fields onload but wheter javascript function is in head or body, it is always not found → When HTML oninput event triggers and Firefox auto populates input fields onload of DOM, Javascript tied it cannot be found (yet)
Summary: When HTML oninput event triggers and Firefox auto populates input fields onload of DOM, Javascript tied it cannot be found (yet) → When HTML oninput event triggers and Firefox auto populates input fields onload of DOM, Javascript tied to it cannot be found (yet)
Invalid, I moved the JavaScript into the <Head> without Defer attribute and worked fine.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.