mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
Use null-prototype objects for maps
A {} has a bunch of names already defined on it (like ‘toString’). When using an object as a map with arbitrary keys, it should not inherit from Object.prototype.
This commit is contained in:
@@ -887,7 +887,6 @@ WorkspaceFactoryController.prototype.clearAll = function() {
|
||||
if (!confirm(msg)) {
|
||||
return;
|
||||
}
|
||||
var hasCategories = this.model.hasElements();
|
||||
this.model.clearToolboxList();
|
||||
this.view.clearToolboxTabs();
|
||||
this.model.savePreloadXml(Blockly.utils.xml.createElement('xml'));
|
||||
@@ -1209,9 +1208,9 @@ WorkspaceFactoryController.prototype.importBlocks = function(file, format) {
|
||||
// If an imported block type is already defined, check if the user wants
|
||||
// to override the current block definition.
|
||||
if (controller.model.hasDefinedBlockTypes(blockTypes)) {
|
||||
var msg = 'An imported block uses the same name as a block '
|
||||
+ 'already in your toolbox. Are you sure you want to override the '
|
||||
+ 'currently defined block?';
|
||||
var msg = 'An imported block uses the same name as a block ' +
|
||||
'already in your toolbox. Are you sure you want to override the ' +
|
||||
'currently defined block?';
|
||||
var continueAnyway = confirm(msg);
|
||||
BlocklyDevTools.Analytics.onWarning(msg);
|
||||
if (!continueAnyway) {
|
||||
|
||||
@@ -360,7 +360,7 @@ WorkspaceFactoryModel.prototype.addCustomTag = function(category, tag) {
|
||||
* @param {!Element} xml The XML to be saved.
|
||||
*/
|
||||
WorkspaceFactoryModel.prototype.savePreloadXml = function(xml) {
|
||||
this.preloadXml = xml
|
||||
this.preloadXml = xml;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -445,8 +445,8 @@ WorkspaceFactoryModel.prototype.updateLibBlockTypes = function(blockTypes) {
|
||||
* @return {boolean} True if blockType is defined, false otherwise.
|
||||
*/
|
||||
WorkspaceFactoryModel.prototype.isDefinedBlockType = function(blockType) {
|
||||
var isStandardBlock = StandardCategories.coreBlockTypes.indexOf(blockType)
|
||||
!= -1;
|
||||
var isStandardBlock =
|
||||
StandardCategories.coreBlockTypes.indexOf(blockType) != -1;
|
||||
var isLibBlock = this.libBlockTypes.indexOf(blockType) != -1;
|
||||
var isImportedBlock = this.importedBlockTypes.indexOf(blockType) != -1;
|
||||
return (isStandardBlock || isLibBlock || isImportedBlock);
|
||||
|
||||
Reference in New Issue
Block a user