Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS error with latest master #45

Closed
Rudloff opened this issue Nov 28, 2016 · 14 comments
Closed

JS error with latest master #45

Rudloff opened this issue Nov 28, 2016 · 14 comments
Labels
Milestone

Comments

@Rudloff
Copy link
Contributor

Rudloff commented Nov 28, 2016

With Page Forms 4.0.2 and SFS 483f370, nothing happens when I select something in a select input.

I have a series of select inputs like this:
image
The second one is populated based on what has been selected in the first one, and so on...
It works correctly with SFS 1.3 and SF 3.3.2 but with the latest master nothing happens.

I get nothing in the browser console when I select something (no AJAX query and no JS error) but I get this JS error during page load:

23:59:08,454 Error: Syntax error, unrecognized expression: input[name=Recherche avancée\[pays\]] 1 load.php:1496:8
	Sizzle</Sizzle.error http://localhost/archi-mediawiki/load.php:1496:8
	Sizzle</Sizzle.tokenize http://localhost/archi-mediawiki/load.php:2113:4
	Sizzle</Sizzle.select http://localhost/archi-mediawiki/load.php:2517:20
	Sizzle http://localhost/archi-mediawiki/load.php:893:9
	.find http://localhost/archi-mediawiki/load.php:2733:4
	jQuery.fn.init http://localhost/archi-mediawiki/load.php:2850:14
	jQuery http://localhost/archi-mediawiki/load.php:73:10
	<anonyme> http://localhost/archi-mediawiki/extensions/SemanticFormsSelect/res/scriptSelect.js:308:7
	<anonyme> http://localhost/archi-mediawiki/extensions/SemanticFormsSelect/res/scriptSelect.js:183:3

(However, I get a similar error with the old version and the form works so I'm not sure it is relevant.)

@Rudloff
Copy link
Contributor Author

Rudloff commented Nov 28, 2016

I think I managed to reproduce it on sandbox: https://sandbox.semantic-mediawiki.org/wiki/Sp%C3%A9cial:RunQuery/SFS_test

@kghbln kghbln mentioned this issue Dec 1, 2016
9 tasks
@kghbln
Copy link
Member

kghbln commented Dec 1, 2016

@Rudloff Thanks for reporting and setting up an example on sandbox. I have now also asked @Seb35 to give it a try who also just installed it on a wiki.

@Seb35
Copy link
Contributor

Seb35 commented Dec 1, 2016

With Firefox, I was able to reproduce it on MW 1.29alpha (no AJAX and no JS error, not even the one given above) and I see the error on the sandbox. However I don’t have any idea how to solve it.

If one consider jQuery Sizzle (which emits the top error) don’t have a bug (working hypothesis), the error is located on https://github.com/SemanticMediaWiki/SemanticFormsSelect/blob/master/res/scriptSelect.js#L308. Given this file was not changed since 21 September 2015, perhaps some JS resource was forgotten during the recent change in extension loading (just an idea of something which can be checked).

@Seb35
Copy link
Contributor

Seb35 commented Dec 1, 2016

Searched a bit, here are my first results, I can not continue as of now.

  1. When trying in Firefox console $('select[name=SFS test\\[pays\\]]'), the answer is Error: Syntax error, unrecognized expression: select[name=SFS test\[pays\]].
  2. When trying in Firefox console $('select[name=\'SFS test[pays]\']'), the answer is Object { length: 1, prevObject: Object, context: HTMLDocument → SFS_test, selector: "select[name='SFS test[pays]']", 1 de plus… } (better).

I tried to add this in res/scriptSelect.js, but unsuccessful for now (perhaps a mistake on my side).

@Seb35
Copy link
Contributor

Seb35 commented Dec 1, 2016

I investigated further and I have difficulties understanding what is happening. My previous comment was probably out-of-scope regarding this bug. My results:

  • the only JS in SFS didn’t changed since SFS 1.3 so it cannot be that,
  • the HTML didn’t changed between SFS 1.3 so it cannot be some HTML new structure

The only remaining possibility (I guess) is the JS in PageForms changed in a way it becames incompatible with SFS.

@Seb35
Copy link
Contributor

Seb35 commented Dec 1, 2016

End of the story: with the change SemanticForms → PageForms, there is in SFS script res/scriptSelect.js: $( "form#sfForm" ). Change it to $( "form#pfForm" ). And it works.

@kghbln
Copy link
Member

kghbln commented Dec 1, 2016

@Seb35 Thanks a lot for digging into this and finding the solution. I guess you deserve to do the respective pull request. :) Great work!

@kghbln kghbln added the bug label Dec 1, 2016
@kghbln kghbln added this to the 2.0.0 milestone Dec 1, 2016
@kghbln kghbln closed this as completed in #46 Dec 1, 2016
kghbln added a commit that referenced this issue Dec 1, 2016
Fix issue 'JS error with latest master' #45
@kghbln
Copy link
Member

kghbln commented Dec 1, 2016

I would have loved to update sandbox to latest master, but somehow composer fails to do so. It just clones 483f370 and that's it. :| This is utmost annoying after we have gotten this far. I am grumpy now.

@Seb35
Copy link
Contributor

Seb35 commented Dec 2, 2016

I had also this commit when downloading with Composer. I guess there is no push hook on GitHub, see https://packagist.org/about#how-to-update-packages. Without it, it is only updated once a week (see the same page).

@kghbln
Copy link
Member

kghbln commented Dec 2, 2016

Usually master is pulled immediately and the last update happened a fortnight ago so I created #47 to track this.

@kghbln
Copy link
Member

kghbln commented Dec 4, 2016

So sandbox is updated now.

@Rudloff
Copy link
Contributor Author

Rudloff commented Dec 5, 2016

The form inputs on the usecase on sandbox are now rendered as text inputs. I guess it means SFS is not properly loaded.

@kghbln
Copy link
Member

kghbln commented Dec 5, 2016

I guess it means SFS is not properly loaded.

Indeed SFS was no longer automatically loaded via composer after I upgraded to latest master, which I assumed would be the case. Now showing up on Special:Version and the example is working too.

@Rudloff
Copy link
Contributor Author

Rudloff commented Dec 5, 2016

I confirm the issue is fixed on sandbox and on my server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants