Closed
Bug 1242645
Opened 10 years ago
Closed 10 years ago
If/Else If statements not working properly without closing Else statement.
Categories
(Core :: General, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: jgvicke, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
Build ID: 20160105164030
Steps to reproduce:
In my custom JS, I had this code:
if (isToggle) {
updateToggle($(this), desiredSpec[property]);
} else if (isSpan) {
this.innerHTML = desiredSpec[property];
} else if (isRange || isNumberInput) {
$(this).val(desiredSpec[property]);
}
The last else if would always execute even when (isRange || isNumberInput) == false. If I put an empty closing else statement like this:
if (isToggle) {
updateToggle($(this), desiredSpec[property]);
} else if (isSpan) {
this.innerHTML = desiredSpec[property];
} else if (isRange || isNumberInput) {
$(this).val(desiredSpec[property]);
} else {
}
It works as expected.
Actual results:
$(this).val(desiredSpec[property]); fires every time, reguardless of conditional statement.
Expected results:
$(this).val(desiredSpec[property]); should only fire when (isRange || isNumberInput) == true
Comment 1•10 years ago
|
||
can you post a standalone testcase?
Updated•10 years ago
|
Flags: needinfo?(jgvicke)
Comment 2•10 years ago
|
||
Could not reproduce the issue on:
- Released: 43.0.4, Build ID 20160105164030, User Agent Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:43.0) Gecko/20100101 Firefox/43.0
- Nightly 47.0a1, Build ID 20160127030236, Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0
Reporter, could you please confirm whether this issue still occurs using Firefox in safe mode or with a new profile?
http://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode
http://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles
If bug still occurs, please post a standalone testcase, as requested in Comment 1.
Comment 3•10 years ago
|
||
Marking this as Resolved: Incomplete due to the lack of response from the reporter.
If anyone can still reproduce the issue on the latest versions, feel free to reopen the bug and provide more information.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Flags: needinfo?(jgvicke)
Resolution: --- → INCOMPLETE
Comment 4•8 years ago
|
||
Moving from Core::Untriaged to Core::General https://bugzilla.mozilla.org/show_bug.cgi?id=1407598
Component: Untriaged → General
You need to log in
before you can comment on or make changes to this bug.
Description
•