Page MenuHomePhabricator

"Error: One or more dependencies failed to load" in Flow on Arabic Wikipedia
Closed, ResolvedPublic

Event Timeline

Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptAug 30 2016, 1:25 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Hi @Ibrahim.ID!

Going to https://ar.wikipedia.org/wiki/ويكيبيديا:أسئلة?debug=true (mind the additional ?debug=true here) I get the following output in the web browser's developer console (for more information how you can debug issues in the developer tools of your browser yourself, see: Firefox ≥24 / Internet Explorer / Google Chrome / Apple Safari / Opera):

TypeError: document.getElementById(...) is null

for the line 490 in https://ar.wikipedia.org/wiki/ميدياويكي:Common.js . That line is

var first_string = document.getElementById('wpTextbox1').value; //النص القديم

and should first get fixed by the community, I would say.

Only after fixing that error I would check again if the Flow problem still happens and if this issue in Common.js was unrelated or not. :)

Aklapper renamed this task from "Error: One or more dependencies failed to load" in Flow to "Error: One or more dependencies failed to load" in Flow on Arabic Wikipedia.Aug 30 2016, 1:42 PM

It does fix the problem for me on the first link given in the task description (I could reproduce the problem earlier today).

The code was added according to this discussion in the Village Pump (now archived). The original author of the code is @ASammour

I think the problem is solved. The edit done by @Catrope fix the the error. But I can't really know why it was produce an error?.
document.getElementById ('wpTextBox1').value;
is equal to:
$('#wpTextbox1').val();
The first written in javascript, and the second written in jquery.

I think the problem is solved. The edit done by @Catrope fix the the error. But I can't really know why it was produce an error?.
document.getElementById ('wpTextBox1').value;
is equal to:
$('#wpTextbox1').val();
The first written in javascript, and the second written in jquery.

They behave differently if there is no wpTextbox1 on the page. In that case document.getElementById( 'wpTextbox1' ) returns null; the old code didn't check for this and tried to get .value of null, which fails with a JS error. However, jQuery has built-in checks for this and avoids throwing errors: $( '#wpTextbox1' ) returns an empty jQuery collection (the same as $( [] )), and doing .val() on an empty collection returns '' (an empty string). The code then proceeds to try to set the value of wpTextbox1, and doing .val( 'newValue' ) on an empty collection doesn't throw an error either but just silently does nothing.

Aklapper closed this task as Resolved.Aug 31 2016, 1:14 PM
Aklapper claimed this task.
Aklapper reassigned this task from Aklapper to Catrope.Aug 31 2016, 2:01 PM