mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
Fix document detection.
Andrew LGTMs in person.
This commit is contained in:
@@ -564,12 +564,12 @@ Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN = {
|
||||
* @readonly
|
||||
*/
|
||||
Blockly.Constants.Logic.LOGIC_COMPARE_EXTENSION = function() {
|
||||
// Fix operator labels in RTL
|
||||
// Fix operator labels in RTL.
|
||||
if (this.RTL) {
|
||||
Blockly.Constants.Logic.fixLogicCompareRtlOpLabels.apply(this);
|
||||
}
|
||||
|
||||
// Add onchange handler to ensure types are compatable.
|
||||
// Add onchange handler to ensure types are compatible.
|
||||
this.mixin(Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN);
|
||||
};
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ Blockly.Extensions.buildTooltipForDropdown = function(dropdownName,
|
||||
// Wait for load, in case Blockly.Msg is not yet populated.
|
||||
// runAfterPageLoad() does not run in a Node.js environment due to lack of
|
||||
// document object, in which case skip the validation.
|
||||
if (document) { // Relies on document.readyState
|
||||
if (typeof document == 'object') { // Relies on document.readyState
|
||||
Blockly.utils.runAfterPageLoad(function() {
|
||||
for (var key in lookupTable) {
|
||||
// Will print warnings if reference is missing.
|
||||
@@ -409,7 +409,7 @@ Blockly.Extensions.buildTooltipWithFieldValue = function(msgTemplate,
|
||||
// Wait for load, in case Blockly.Msg is not yet populated.
|
||||
// runAfterPageLoad() does not run in a Node.js environment due to lack of
|
||||
// document object, in which case skip the validation.
|
||||
if (document) { // Relies on document.readyState
|
||||
if (typeof document == 'object') { // Relies on document.readyState
|
||||
Blockly.utils.runAfterPageLoad(function() {
|
||||
// Will print warnings if reference is missing.
|
||||
Blockly.utils.checkMessageReferences(msgTemplate);
|
||||
|
||||
@@ -896,7 +896,7 @@ Blockly.utils.insertAfter_ = function(newNode, refNode) {
|
||||
* @throws Error Will throw if no global document can be found (e.g., Node.js).
|
||||
*/
|
||||
Blockly.utils.runAfterPageLoad = function(fn) {
|
||||
if (!document) {
|
||||
if (typeof document != 'object') {
|
||||
throw new Error('Blockly.utils.runAfterPageLoad() requires browser document.');
|
||||
}
|
||||
if (document.readyState === 'complete') {
|
||||
|
||||
Reference in New Issue
Block a user