jenkins-bot has submitted this change and it was merged.
Change subject: [BREAKING CHANGE] Refine VisualEditorSupportCheck call and
document pattern
......................................................................
[BREAKING CHANGE] Refine VisualEditorSupportCheck call and document pattern
Follows-up I27a8e7b437664.
Call the global as-is instead of via 'window'. This isn't a Window class method
and should not be called as such. It's a fully-fledged global function can be
called as-is. This also benefits JSHint detection. It not being whitelisted, but
used via 'window' made it more error-prone (e.g. when mistyped). Now it can
detect it properly.
It was also wrongly indexed as a class when it is in fact a method.
One could create a private mixin for global to allow multiple global methods
to be documented in categories, but for now indexing 'global' as a single group
in the categories file under Initialisation.
Now that the warning for having a global method is triggered, surpress it with
"-global" in the jsduck.json file.
Change-Id: Id53bdfe1c459ea5995e409644d1b7afddf11227c
---
M .jsduck/categories.json
M .jshintrc
M jsduck.json
M src/init/sa/ve.init.sa.Platform.js
M src/init/ve.init.Platform.js
M src/init/ve.init.SupportCheck.js
6 files changed, 8 insertions(+), 5 deletions(-)
Approvals:
Jforrester: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.jsduck/categories.json b/.jsduck/categories.json
index cd1ddf9..a702011 100644
--- a/.jsduck/categories.json
+++ b/.jsduck/categories.json
@@ -29,7 +29,7 @@
"ve.init",
"ve.init.Platform",
"ve.init.Target",
- "window.VisualEditorSupportCheck"
+ "global"
]
},
{
diff --git a/.jshintrc b/.jshintrc
index 7849936..49f49fb 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -24,6 +24,7 @@
"unicodeJS": false,
"RangeFix": false,
"Papa": false,
- "ve": false
+ "ve": false,
+ "VisualEditorSupportCheck": false
}
}
diff --git a/jsduck.json b/jsduck.json
index 5e42b91..03be39e 100644
--- a/jsduck.json
+++ b/jsduck.json
@@ -4,7 +4,7 @@
"--categories": ".jsduck/categories.json",
"--eg-iframe": ".jsduck/eg-iframe.html",
"--tags": ".jsduck/CustomTags.rb",
- "--warnings": ["-nodoc(class,public)"],
+ "--warnings": ["-nodoc(class,public)", "-global"],
"--builtin-classes": true,
"--processes": "0",
"--warnings-exit-nonzero": true,
diff --git a/src/init/sa/ve.init.sa.Platform.js
b/src/init/sa/ve.init.sa.Platform.js
index 479dc1c..5340276 100644
--- a/src/init/sa/ve.init.sa.Platform.js
+++ b/src/init/sa/ve.init.sa.Platform.js
@@ -188,7 +188,7 @@
promises = [],
fallbacks = $.i18n.fallbacks[ locale ];
- if ( !window.VisualEditorSupportCheck() ) {
+ if ( !VisualEditorSupportCheck() ) {
return $.Deferred().reject().promise();
}
diff --git a/src/init/ve.init.Platform.js b/src/init/ve.init.Platform.js
index 3fcb5b8..e348ebd 100644
--- a/src/init/ve.init.Platform.js
+++ b/src/init/ve.init.Platform.js
@@ -257,7 +257,7 @@
* @return {jQuery.Promise} Promise that will be resolved once initialization
is done
*/
ve.init.Platform.prototype.initialize = function () {
- if ( !window.VisualEditorSupportCheck() ) {
+ if ( !VisualEditorSupportCheck() ) {
return $.Deferred().reject().promise();
}
return $.Deferred().resolve().promise();
diff --git a/src/init/ve.init.SupportCheck.js b/src/init/ve.init.SupportCheck.js
index 1d2eafa..74ec511 100644
--- a/src/init/ve.init.SupportCheck.js
+++ b/src/init/ve.init.SupportCheck.js
@@ -13,6 +13,8 @@
* specific DOM features we use, and SVG support for the user
interface. As we
* use this to check for feature compatibility this file must be
ES3-parsable.
*
+ * @method VisualEditorSupportCheck
+ * @member global
* @return {boolean} True if the environment should support
VisualEditor.
*/
window.VisualEditorSupportCheck = function () {
--
To view, visit https://gerrit.wikimedia.org/r/273484
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id53bdfe1c459ea5995e409644d1b7afddf11227c
Gerrit-PatchSet: 4
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits