chore: Remove various IE hacks and workarounds (#6781)

* chore: Remove IE-specific hacks from flyout_base.ts.

* chore: Remove IE hacks from workspace_svg.ts.

* chore: Remove IE hacks from css.ts.

* chore: Remove IE hacks from xml.ts.

* chore: Remove IE hacks from grid.ts.

* chore: Remove errant logging from flyout_base.ts.

* chore: Remove obsolete comments about IE from bootstrap.js.

* chore: Remove reference to IE from README.

* chore: Clean up trailing spaces in bootstrap.js.
This commit is contained in:
Aaron Dodson
2023-03-14 11:26:38 -07:00
committed by GitHub
parent 0a1096262f
commit 17064a1c39
7 changed files with 13 additions and 86 deletions

View File

@@ -83,4 +83,4 @@ We typically triage all bugs within 2 working days, which includes adding any ap
## Good to Know
* Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs](https://saucelabs.com)
* We support IE11 and test it using [BrowserStack](https://browserstack.com)
* We test browsers using [BrowserStack](https://browserstack.com)

View File

@@ -231,16 +231,11 @@ let content = `
}
.blocklyDraggable {
/* backup for browsers (e.g. IE11) that don't support grab */
cursor: url("<<<PATH>>>/handopen.cur"), auto;
cursor: grab;
cursor: -webkit-grab;
}
/* backup for browsers (e.g. IE11) that don't support grabbing */
.blocklyDragging {
/* backup for browsers (e.g. IE11) that don't support grabbing */
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
cursor: grabbing;
cursor: -webkit-grabbing;
}
@@ -248,8 +243,6 @@ let content = `
/* Changes cursor on mouse down. Not effective in Firefox because of
https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */
.blocklyDraggable:active {
/* backup for browsers (e.g. IE11) that don't support grabbing */
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
cursor: grabbing;
cursor: -webkit-grabbing;
}
@@ -258,8 +251,6 @@ let content = `
ahead of block during a drag. This way the cursor is still a closed hand.
*/
.blocklyBlockDragSurface .blocklyDraggable {
/* backup for browsers (e.g. IE11) that don't support grabbing */
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
cursor: grabbing;
cursor: -webkit-grabbing;
}
@@ -369,13 +360,6 @@ let content = `
box-sizing: border-box;
}
/* Edge and IE introduce a close icon when the input value is longer than a
certain length. This affects our sizing calculations of the text input.
Hiding the close icon to avoid that. */
.blocklyHtmlInput::-ms-clear {
display: none;
}
/* Remove the increase and decrease arrows on the field number editor */
input.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,
input.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {

View File

@@ -529,14 +529,9 @@ export abstract class Flyout extends DeleteArea implements IFlyout {
this.svgGroup_?.setAttribute('height', height.toString());
this.workspace_.setCachedParentSvgSize(width, height);
if (this.svgGroup_?.tagName === 'svg') {
if (this.svgGroup_) {
const transform = 'translate(' + x + 'px,' + y + 'px)';
dom.setCssTransform(this.svgGroup_, transform);
} else {
// IE and Edge don't support CSS transforms on SVG elements so
// it's important to set the transform on the SVG element itself
const transform = 'translate(' + x + ',' + y + ')';
this.svgGroup_?.setAttribute('transform', transform);
}
// Update the scrollbar (if one exists).
@@ -603,19 +598,6 @@ export abstract class Flyout extends DeleteArea implements IFlyout {
this.layout_(flyoutInfo.contents, flyoutInfo.gaps);
// IE 11 is an incompetent browser that fails to fire mouseout events.
// When the mouse is over the background, deselect all blocks.
function deselectAll(this: Flyout) {
const topBlocks = this.workspace_.getTopBlocks(false);
for (let i = 0, block; block = topBlocks[i]; i++) {
block.removeSelect();
}
}
this.listeners_.push(browserEvents.conditionalBind(
(this.svgBackground_ as SVGPathElement), 'pointerover', this,
deselectAll));
if (this.horizontalLayout) {
this.height_ = 0;
} else {

View File

@@ -89,8 +89,7 @@ export class Grid {
* @internal
*/
update(scale: number) {
// MSIE freaks if it sees a 0x0 pattern, so set empty patterns to 100x100.
const safeSpacing = this.spacing * scale || 100;
const safeSpacing = this.spacing * scale;
this.pattern.setAttribute('width', safeSpacing.toString());
this.pattern.setAttribute('height', safeSpacing.toString());

View File

@@ -1890,39 +1890,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
common.setMainWorkspace(this);
// We call e.preventDefault in many event handlers which means we
// need to explicitly grab focus (e.g from a textarea) because
// the browser will not do it for us. How to do this is browser
// dependent.
this.setBrowserFocus();
}
}
/** Set the workspace to have focus in the browser. */
private setBrowserFocus() {
// Blur whatever was focused since explicitly grabbing focus below does not
// work in Edge.
// In IE, SVGs can't be blurred or focused. Check to make sure the current
// focus can be blurred before doing so.
// See https://github.com/google/blockly/issues/4440
if (document.activeElement &&
document.activeElement instanceof HTMLElement) {
document.activeElement.blur();
}
try {
// Focus the workspace SVG - this is for Chrome and Firefox.
// the browser will not do it for us.
this.getParentSvg().focus({preventScroll: true});
} catch (e) {
// IE and Edge do not support focus on SVG elements. When that fails
// above, get the injectionDiv (the workspace's parent) and focus that
// instead. This doesn't work in Chrome.
try {
// In IE11, use setActive (which is IE only) so the page doesn't scroll
// to the workspace gaining focus.
(this.getParentSvg().parentElement as any).setActive();
} catch (e) {
// setActive support was discontinued in Edge so when that fails, call
// focus instead.
this.getParentSvg().parentElement!.focus({preventScroll: true});
}
}
}

View File

@@ -171,9 +171,7 @@ export function blockToDom(block: Block, opt_noId?: boolean): Element|
const element = utilsXml.createElement(block.isShadow() ? 'shadow' : 'block');
element.setAttribute('type', block.type);
if (!opt_noId) {
// It's important to use setAttribute here otherwise IE11 won't serialize
// the block's ID when domToText is called.
element.setAttribute('id', block.id);
element.id = block.id;
}
if (block.mutationToDom) {
// Custom data for an advanced block.

21
tests/bootstrap.js vendored
View File

@@ -20,17 +20,12 @@
*
* See tests/playground.html for example usage.
*
* Exception: for speed and compatibility reasons, if this is
* script is loaded in Internet Explorer or from a host other than
* localhost, blockly_compressed.js (et al.) will be loaded
* instead. IE 11 doesn't understand modern JavaScript, and
* because of the sequential, non-parallel module loading carried
* out by thedeubg module loader can be painfully tedious over a
* slow network connection. (This can be overridden by the page
* if desired.)
*
* (Note also that this file eschews certain modern JS constructs,
* like template literals, for compatibility with IE 11.)
* Exception: for speed, if this is script is from a host other
* than localhost, blockly_compressed.js (et al.) will be loaded
* instead. Because of the sequential, non-parallel module loading
* carried out by the debug module loader, loading can be painfully
* tedious over a slow network connection. (This can be overridden
* by the page if desired.)
*
* The bootstrap code will consult a BLOCKLY_BOOTSTRAP_OPTIONS
* global variable to determine what to load. This must be set
@@ -107,7 +102,7 @@
// the named export corresponding to the mentioned global variable
// will be imported.
//
// Exception: in compressed mode, the UMD wrapeprs generated by
// Exception: in compressed mode, the UMD wrappers generated by
// chunkWrapper() in scripts/gulpfiles/build_tasks.js already pull
// out the desired named export - so in that case the entries here
// are treated identically to those in namedImports.
@@ -155,7 +150,7 @@
// Disable loading of closure/goog/deps.js (which doesn't exist).
window.CLOSURE_NO_DEPS = true;
// Load the Closure Library's base.js (the only part of the
// libary we use, mainly for goog.require / goog.provide /
// library we use, mainly for goog.require / goog.provide /
// goog.module).
document.write(
`<script src="${options.root}build/src/closure/goog/base.js"></script>`