To properly finish the work of #1760548: Remove dependency on jQuery and drupal.js for JS settings Drupal.settings needs to be removed from core scripts and use the new global drupalSettings.

  1. Add a new variable to the closure:
    (function ($, Drupal, drupalSettings) {
    
    })(jQuery, Drupal, drupalSettings);
  2. replace Drupal.settings with drupalSettings

This can be taken care of after feature freeze, please direct your attention to feature requests until then :)

CommentFileSizeAuthor
#35 core-js-drupalSettings-1793648-35.patch28.28 KBnod_
PASSED: [[SimpleTest]]: [MySQL] 58,744 pass(es). View
#32 core-js-drupalSettings-1793648-32.patch28.26 KBrteijeiro
PASSED: [[SimpleTest]]: [MySQL] 59,244 pass(es). View
#29 core-js-drupalSettings-1793648-29.patch28.26 KBnod_
PASSED: [[SimpleTest]]: [MySQL] 58,924 pass(es). View
#25 core-js-drupalSettings-1793648-25.patch16.16 KBrteijeiro
PASSED: [[SimpleTest]]: [MySQL] 58,383 pass(es). View
#22 core-js-drupalSettings-1793648-22.patch17.33 KBnod_
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch core-js-drupalSettings-1793648-22.patch. Unable to apply patch. See the log in the details link for more information. View
#19 drupalSettings-19.patch17.3 KBdroplet
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupalSettings-19.patch. Unable to apply patch. See the log in the details link for more information. View
#15 drupalSettings.patch26.39 KBkmox83
FAILED: [[SimpleTest]]: [MySQL] 51,142 pass(es), 59 fail(s), and 49 exception(s). View
#10 drupalSetting.patch26.78 KBkmox83
PASSED: [[SimpleTest]]: [MySQL] 52,629 pass(es). View
#4 drupalSettings.patch17.23 KBdroplet
PASSED: [[SimpleTest]]: [MySQL] 52,654 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

nod_’s picture

Issue summary: View changes

note about feature freeze

catch’s picture

Priority: Normal » Critical
nod_’s picture

Status: Active » Postponed

Since I'd like that after feature freeze taking it out of the thresholds. I'll put it back when the time comes.

webchick’s picture

Priority: Critical » Normal
Status: Postponed » Active

We're post-feature freeze now, so this can happen. However, since nothing is broken without this being done, don't see why it's critical. Seems like a nice to have?

droplet’s picture

Status: Active » Needs review
Issue tags: +Quick fix, +Novice
FileSize
17.23 KB
PASSED: [[SimpleTest]]: [MySQL] 52,654 pass(es). View

big & small changes. This kind of changes aren't really need to run crazy manual tests. Errors should be obviously show on browsers console if it had.

Status: Needs review » Needs work
Issue tags: -Quick fix, -Novice, -JavaScript clean-up, -js-novice, -Needs JS testing

The last submitted patch, drupalSettings.patch, failed testing.

droplet’s picture

Status: Needs work » Needs review
Issue tags: +Quick fix, +Novice, +JavaScript clean-up, +js-novice, +Needs JS testing

#4: drupalSettings.patch queued for re-testing.

nod_’s picture

Status: Needs review » Active
Issue tags: -Quick fix, -Novice

not a nice to have, it's to get rid of the settings paramter in attachBehaviors. Never seen any code using the parameter to change the settings behaviors are initialised with. it's time to get rid of it since it's available in a better place.

nod_’s picture

Issue tags: +Quick fix, +Novice

wow sorry, way outdated page I commented on.

I guess the attachbehavior thing should be a follow-up of the follow-up since there is no serious testing needed for the current change as droplet said.

nod_’s picture

Status: Active » Needs review
kmox83’s picture

FileSize
26.78 KB
PASSED: [[SimpleTest]]: [MySQL] 52,629 pass(es). View
skilip’s picture

Any reason why drupalSettingss is used instead of drupalSettings?

webchick’s picture

Status: Needs review » Needs work
Issue tags: +Needs manual testing

Because someone made a typo in find/replace. ;)

And since such typos are never going to be caught with the testbot, marking as "Needs manual testing."

kmox83’s picture

Mistake, I am packing the correct.

droplet’s picture

ahh. I forgot the PHP files, lol. Thanks

@kmox83, you should not find & replace. #4 is more than it. :)

kmox83’s picture

FileSize
26.39 KB
FAILED: [[SimpleTest]]: [MySQL] 51,142 pass(es), 59 fail(s), and 49 exception(s). View

It was not the only, in drupal.js it needs to be assigned anyway the Drupal.settings so it can be compatible with the modules which still use that.

skilip’s picture

Ok, I'm completely new to using drupalSettings so I'm sorry in advance for stupid questions.

First things I noticed after a quick review:

Code in drupal.js is wrapped like this:

(function ($, Drupal, drupalSettings) {
...
})(jQuery, Drupal, window.drupalSettings);

Code in ajax.js however is wrapped like this:

(function ($, window) {
...
})(jQuery, this);

I know that it won't cause troubles but shouldn't that be consistently written?

skilip’s picture

Basically I should prefer some kind of hierarchical order in the variables passed to (function(..) {})(..);

E.g.:

  1. jQuery
  2. Drupal
  3. drupalSettings
  4. ...
  5. ...

But that's probably another issue, right?

Wim Leers’s picture

#17: Yes, that would be another issue. You'd have to talk to nod_ about that and then update the Drupal JS coding standards: http://drupal.org/node/172169.

I agree that would be nice, but it's of course very nitpick: the order is completely irrelevant for the code itself, it's just a very small DX thing.

droplet’s picture

Status: Needs work » Needs review
FileSize
17.3 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupalSettings-19.patch. Unable to apply patch. See the log in the details link for more information. View

reload #4 + changed Docs Drupal.settings to drupalSettings.

nod_’s picture

Status: Needs review » Needs work
Issue tags: +Quick fix, +Novice, +Needs manual testing, +JavaScript clean-up, +js-novice, +Needs JS testing

The last submitted patch, drupalSettings-19.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
FileSize
17.33 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch core-js-drupalSettings-1793648-22.patch. Unable to apply patch. See the log in the details link for more information. View

reroll

nod_’s picture

Status: Needs review » Needs work
Issue tags: +Quick fix, +Novice, +Needs manual testing, +JavaScript clean-up, +js-novice, +Needs JS testing

The last submitted patch, core-js-drupalSettings-1793648-22.patch, failed testing.

rteijeiro’s picture

Status: Needs work » Needs review
FileSize
16.16 KB
PASSED: [[SimpleTest]]: [MySQL] 58,383 pass(es). View

Re-rolled

nod_’s picture

OK for me.

Now let's wait forever for someone who can RTBC :p

aspilicious’s picture

Status: Needs review » Needs work

I grepped around and found some comments that still reference Drupal.settings

nod_’s picture

Oh I only looked in the JS files, but some might be left in the PHP indeed.

nod_’s picture

Status: Needs work » Needs review
FileSize
28.26 KB
PASSED: [[SimpleTest]]: [MySQL] 58,924 pass(es). View

That should do it.

rteijeiro’s picture

Status: Needs review » Reviewed & tested by the community

It seems RTBC. No "Drupal.settings" statement found.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Darn, sorry, no longer applies.

rteijeiro’s picture

Status: Needs work » Needs review
FileSize
28.26 KB
PASSED: [[SimpleTest]]: [MySQL] 59,244 pass(es). View

Re-rolled.

nod_’s picture

Status: Needs review » Reviewed & tested by the community

all good.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Darn. Still no longer applies. :\

nod_’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
28.28 KB
PASSED: [[SimpleTest]]: [MySQL] 58,744 pass(es). View

reroll

rteijeiro’s picture

Now applies well. Let's see what says the testbot and RTBC if green ;)

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Testbot can't test anything meaningful with JS changes anyway, so going to get this in while it's hot. :)

Committed and pushed to 8.x. Thanks!

webchick’s picture

Title: Follow-up: replace all occurence of Drupal.settings with drupalSettings » Change notice: replace all occurence of Drupal.settings with drupalSettings
Status: Fixed » Active
Issue tags: +Needs change record

Oops. And change notice.

nod_’s picture

Title: Change notice: replace all occurence of Drupal.settings with drupalSettings » Follow-up: replace all occurence of Drupal.settings with drupalSettings
Status: Active » Fixed
Issue tags: -Needs manual testing, -Needs change record, -Needs JS testing

We already had one, updated https://drupal.org/node/1793334.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

code block