Forum How do I...?

JQuery and windows 10

rws68
Hi,
I'm not having any success using jquery... I am using the windows GUI not the command line.

If I simply add my .html file (which works in a browser),
princexml reports no errors, but doesn't execute any of the jquery.

If I "Add JS" (i.e. the lates jquery.js, then it reports jquery:3874 TypeError: invalid arguments.

Even if I block out all the code within the $( document ).ready(function() ....

Everything works fine without jquery (Even css page referencing, which work beautifully ...)

So I'm thinking I have configured the windows application wrongly somehow. Any suggestions ?

Rob
mikeday
You may need to try the latest build of Prince. The Windows package doesn't include the GUI, but can be unzipped in the Engine/ folder so you can use it with the GUI you already have installed.
rws68
I've got prince 10 rev 7...turns out I was using jquery 3.1.1 which was the problem.
I went to an older version and it works fine.
hallvord
Hi, turns out jQuery 3.1.1 requires support for a method called
document.implementation.createHTMLDocument()
.

They have written a method to check if a bug-free version of createHTMLDocument() exists (to guard against a bug in particular Safari versions) but unfortunately that method fails to check if createHTMLDocument() exists in the first place..
// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() {
	var body = document.implementation.createHTMLDocument( "" ).body;
	body.innerHTML = "<form></form><form></form>";
	return body.childNodes.length === 2;
} )();


This can either be resolved by Prince adding support for this method or jQuery detecting that this method might be absent and conclude it's best not to try calling it if it's not there. :)

Announcement: repos for tests/utils

hallvord
I was thinking of submitting a pull request to jQuery asking them to improve their detection - however, I notice from pull requests like https://github.com/kenwheeler/cash/pull/105 that this method seems to be gaining popularity. Perhaps Prince needs it sooner rather than later..

Announcement: repos for tests/utils

mikeday
The latest builds now support the DOMImplementation.createHTMLDocument function. :)
hallvord
I've tested jQuery 3.1.1 and it now works :)

Announcement: repos for tests/utils