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
Globalize jquery enhanced #623
Conversation
@@ -0,0 +1,173 @@ | |||
define(["jquery","core/utils"], function($, utils) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a straight copy and paste from core/utils (where this code used to live). This code does not require review.
Actually, I'm just going to annotate the code. As it's not as many changes as it looks. |
|
||
|
||
[], | ||
function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where I ripped out the additions to JQuery from.
Ok, finished annotations... ready for review. |
I am reviewing this. Trying to be careful though. |
@halindrome really appreciate your time, thoroughness, help, and support! Your ideas are vastly improving what we are doing here. |
Question - do you think this version fixes the general problem that our utils.js methods are not exposed to jquery extended objects when they are used in extensions? 'Cause my testing shows that getDfnTitles, for example, is not a method on a jquery extended object in a JS file loaded by a respec-enabled page. |
@halindrome, it should fix it. It literally just puts the extended jQuery into the window object before any of the plugins run. |
getTextNodes(this[0]); | ||
return textNodes; | ||
}; | ||
window.$ = $; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@halindrome here be the magic!!!!! 🌟
An extension can also |
I think we are talking past one another. Before we started messing with this, tne utils.js module pushed a bunch of methods into the jquery function prototype so that they were all added to any jquery objects that are later created. So, when data-oninclude is defined that method will be called and jquery already has the extensions that permit easy integration with respec. That is not currently happening in this branch. Extension scripts don't use require, and in any event there are tons of them out there. We can't ask them to all go change something in order to start working again. |
Just to be clear - these extensions don't ASK for anything. They are just snippets of JS that get run within the context of ReSpec because it just works. |
Understood. They don't need to ask. It will just work* (terms and conditions apply).
|
Well - in the case where I am testing my method is called from the data-oninclude handler and the methods are not htere. Check out http://dev.spec-ops.io/webpayments-ig/VCTF/use-cases - it loads from this branch's build of respec. |
@halindrome, that version of ReSpec seems to be wrong (or didn't build?). It's missing this code. See, in particular, "profile-w3c-common.js". The code from this PR is not there? |
yikes..... weird. testing |
@halindrome, in particular:
is not there. And neither is the |
In other news! YAY! the sourcemap work just came in handy... in even other news, it's 4:30 am, of shit I better got to sleep! 👍 |
*oh |
Okay - no idea why it had not built when I changed branches. I do note that it is complaining about trying to load node_modules/promise-polyfill/Promise.js from the built version. I will try adding that to collection of required components that need to be included in the build. But yes, I can confirm that the object is extended! Get some sleep. |
Can you please post a new bug with the error? That should only happen if it's missing from your |
I will do. I do see that there is a dependency on it in that core/jquer-enhanced requires Promise, but we never load hqyer-enhanced in the profile-w3c-common.js file |
Oh - and otherwise LGTM. |
Confirmed... it is going to the network for Promise.js. My thought is to just remove it, as all the browsers we target support it: http://caniuse.com/#search=Promise |
Huh. Remember people use this for editors drafts and we have no control at all who revirews those. Including people who use older user agents. ReSpec - it's not just for development any more. (tm) |
@halindrome, sure, but we have to cut off somewhere. Promises have been natively supported in browsers for over a year, and all browsers are now evergreen. It seems highly unlikely people reading specs (specially ed drafts) won't be running a browser that is at most 3 months old. |
I am willing to try this - I just note for the record that it could bite us in the ass. In particular with Windows users who have not moved to Windows 10 and for whatever reason use IE. |
Let's see what happens. If it's bad, we can quickly add the poly back. |
Assuming this passes I am comfortable with you merging and pushing a new release. |
Ha! I think ./tests/headless.js just ruined the party. |
you're right. I had this problem the other day too. UGGH |
678d29b
to
71e209f
Compare
Backed out the last commit. |
Ok, will merge this after it turns green and figure out why Promise is not being inserted tomorrow (unless you want to have a look). The |
works for me. I will play with it a little in a new (local) branch once it is all merged. |
Globalize jquery enhanced
See commit list... I'm going to break this up into several PRs where I can.