use existing polyfills to regain IE compatibility

This commit is contained in:
Rachel Fenichel 2016-11-18 16:20:29 -08:00
parent ca7b713c15
commit fe6d4589e0
4 changed files with 20 additions and 12 deletions

View file

@ -622,10 +622,12 @@ Blockly.Block.prototype.setInsertionMarker = function(insertionMarker) {
return; // No change.
}
this.isInsertionMarker_ = insertionMarker;
// TODO: handle removing insertion marker status.
if (this.isInsertionMarker_) {
this.setColour(Blockly.Colours.insertionMarker);
this.setOpacity(Blockly.Colours.insertionMarkerOpacity);
this.svgGroup_.classList.add('blocklyInsertionMarker');
Blockly.addClass_(/** @type {!Element} */ (this.svgGroup_),
'blocklyInsertionMarker');
}
};

View file

@ -336,10 +336,12 @@ Blockly.BlockSvg.prototype.updateColour = function() {
Blockly.BlockSvg.prototype.highlightForReplacement = function(add) {
if (add) {
this.svgPath_.setAttribute('filter', 'url(#blocklyReplacementGlowFilter)');
this.svgGroup_.classList.add('blocklyReplaceable');
Blockly.addClass_(/** @type {!Element} */ (this.svgGroup_),
'blocklyReplaceable');
} else {
this.svgPath_.removeAttribute('filter');
this.svgGroup_.classList.remove('blocklyReplaceable');
Blockly.removeClass_(/** @type {!Element} */ (this.svgGroup_),
'blocklyReplaceable');
}
};
@ -614,7 +616,7 @@ Blockly.BlockSvg.prototype.renderDraw_ = function(metrics) {
*/
Blockly.BlockSvg.prototype.renderClassify_ = function(metrics) {
var shapes = [];
if (this.isShadow_) {
shapes.push('argument');
} else {
@ -630,9 +632,9 @@ Blockly.BlockSvg.prototype.renderClassify_ = function(metrics) {
shapes.push('end');
}
}
this.svgGroup_.setAttribute('data-shapes', shapes.join(' '));
if (this.getCategory()) {
this.svgGroup_.setAttribute('data-category', this.getCategory());
}

View file

@ -510,10 +510,12 @@ Blockly.BlockSvg.prototype.updateColour = function() {
Blockly.BlockSvg.prototype.highlightForReplacement = function(add) {
if (add) {
this.svgPath_.setAttribute('filter', 'url(#blocklyReplacementGlowFilter)');
this.svgGroup_.classList.add('blocklyReplaceable');
Blockly.addClass_(/** @type {!Element} */ (this.svgGroup_),
'blocklyReplaceable');
} else {
this.svgPath_.removeAttribute('filter');
this.svgGroup_.classList.remove('blocklyReplaceable');
Blockly.removeClass_(/** @type {!Element} */ (this.svgGroup_),
'blocklyReplaceable');
}
};
@ -531,10 +533,12 @@ Blockly.BlockSvg.prototype.highlightShapeForInput = function(conn, add) {
var inputShape = this.inputShapes_[input.name];
if (add) {
inputShape.setAttribute('filter', 'url(#blocklyReplacementGlowFilter)');
inputShape.classList.add('blocklyReplaceable');
Blockly.addClass_(/** @type {!Element} */ (this.svgGroup_),
'blocklyReplaceable');
} else {
inputShape.removeAttribute('filter');
inputShape.classList.remove('blocklyReplaceable');
Blockly.removeClass_(/** @type {!Element} */ (this.svgGroup_),
'blocklyReplaceable');
}
};

View file

@ -114,7 +114,7 @@ Blockly.createDom_ = function(container, options) {
// Set all gaussian blur pixels to 1 opacity before applying flood
var componentTransfer = Blockly.createSvgElement('feComponentTransfer', {'result': 'outBlur'}, stackGlowFilter);
Blockly.createSvgElement('feFuncA',
{'type': 'table', 'tableValues': '0' + ' 1'.repeat(16)}, componentTransfer);
{'type': 'table', 'tableValues': '0' + goog.string.repeat(' 1', 16)}, componentTransfer);
// Color the highlight
Blockly.createSvgElement('feFlood',
{'flood-color': Blockly.Colours.stackGlow,
@ -135,7 +135,7 @@ Blockly.createDom_ = function(container, options) {
// Set all gaussian blur pixels to 1 opacity before applying flood
var componentTransfer = Blockly.createSvgElement('feComponentTransfer', {'result': 'outBlur'}, replacementGlowFilter);
Blockly.createSvgElement('feFuncA',
{'type': 'table', 'tableValues': '0' + ' 1'.repeat(16)}, componentTransfer);
{'type': 'table', 'tableValues': '0' + goog.string.repeat(' 1', 16)}, componentTransfer);
// Color the highlight
Blockly.createSvgElement('feFlood',
{'flood-color': Blockly.Colours.replacementGlow,