From 62f0f61edaefa96e91ade8df132085f4d77a7913 Mon Sep 17 00:00:00 2001 From: mcyph <20507948+mcyph@users.noreply.github.com> Date: Sat, 20 Mar 2021 14:58:27 +1100 Subject: [PATCH] started removing support for vml --- examples/contexticons.html | 2 +- examples/grapheditor/www/js/Dialogs.js | 16 ++--- examples/grapheditor/www/js/Editor.js | 7 --- examples/grapheditor/www/js/EditorUi.js | 9 +-- examples/grapheditor/www/js/Graph.js | 12 +--- examples/grapheditor/www/js/Sidebar.js | 15 +---- src/js/handler/mxConnectionHandler.js | 4 +- src/js/handler/mxRubberband.js | 4 +- src/js/mxClient.js | 77 ++++--------------------- src/js/shape/mxImageShape.js | 2 +- src/js/shape/mxShape.js | 10 +--- src/js/shape/mxText.js | 2 +- src/js/util/mxUtils.js | 14 +---- src/js/view/mxCellEditor.js | 46 +++++---------- src/js/view/mxGraph.js | 4 -- src/js/view/mxPrintPreview.js | 19 +----- 16 files changed, 54 insertions(+), 189 deletions(-) diff --git a/examples/contexticons.html b/examples/contexticons.html index 0340a1755..ab871d3ee 100644 --- a/examples/contexticons.html +++ b/examples/contexticons.html @@ -139,7 +139,7 @@ { if (this.state != null && this.domNode != null) { - var dy = (mxClient.IS_VML && document.compatMode == 'CSS1Compat') ? 20 : 4; + var dy = 4; this.domNode.style.left = (this.state.x + this.state.width - 56) + 'px'; this.domNode.style.top = (this.state.y + this.state.height + dy) + 'px'; } diff --git a/examples/grapheditor/www/js/Dialogs.js b/examples/grapheditor/www/js/Dialogs.js index 6f85f9e30..9531a7f95 100644 --- a/examples/grapheditor/www/js/Dialogs.js +++ b/examples/grapheditor/www/js/Dialogs.js @@ -15,7 +15,7 @@ var OpenDialog = function() iframe.frameBorder = '0'; // Adds padding as a workaround for box model in older IE versions - var dx = (mxClient.IS_VML && (document.documentMode == null || document.documentMode < 8)) ? 20 : 0; + var dx = 0; iframe.setAttribute('width', (((Editor.useLocalStorage) ? 640 : 320) + dx) + 'px'); iframe.setAttribute('height', (((Editor.useLocalStorage) ? 480 : 220) + dx) + 'px'); @@ -1688,12 +1688,8 @@ var LinkDialog = function(editorUi, initialValue, btnLabel, fn) inner.style.whiteSpace = 'nowrap'; inner.style.textOverflow = 'clip'; inner.style.cursor = 'default'; - - if (!mxClient.IS_VML) - { - inner.style.paddingRight = '20px'; - } - + inner.style.paddingRight = '20px'; + var linkInput = document.createElement('input'); linkInput.setAttribute('value', initialValue); linkInput.setAttribute('placeholder', 'http://www.example.com/'); @@ -1712,10 +1708,8 @@ var LinkDialog = function(editorUi, initialValue, btnLabel, fn) cross.style.width = '12px'; cross.style.height = '14px'; cross.style.cursor = 'pointer'; - - // Workaround for inline-block not supported in IE - cross.style.display = (mxClient.IS_VML) ? 'inline' : 'inline-block'; - cross.style.top = ((mxClient.IS_VML) ? 0 : 3) + 'px'; + cross.style.display = 'inline-block'; + cross.style.top = '3px'; // Needed to block event transparency in IE cross.style.background = 'url(' + IMAGE_PATH + '/transparent.gif)'; diff --git a/examples/grapheditor/www/js/Editor.js b/examples/grapheditor/www/js/Editor.js index db5578dcd..e486dfdcf 100644 --- a/examples/grapheditor/www/js/Editor.js +++ b/examples/grapheditor/www/js/Editor.js @@ -783,13 +783,6 @@ function Dialog(editorUi, elt, w, h, modal, closable, onClose, noScroll, transpa { var dx = 0; - if (mxClient.IS_VML && (document.documentMode == null || document.documentMode < 8)) - { - // Adds padding as a workaround for box model in older IE versions - // This needs to match the total padding of geDialog in CSS - dx = 80; - } - w += dx; h += dx; diff --git a/examples/grapheditor/www/js/EditorUi.js b/examples/grapheditor/www/js/EditorUi.js index 91495d4d4..ef6c16851 100644 --- a/examples/grapheditor/www/js/EditorUi.js +++ b/examples/grapheditor/www/js/EditorUi.js @@ -1875,12 +1875,9 @@ EditorUi.prototype.initCanvas = function() this.chromelessToolbar.style.padding = '10px 10px 8px 10px'; this.chromelessToolbar.style.left = (graph.isViewer()) ? '0' : '50%'; - if (!mxClient.IS_VML) - { - mxUtils.setPrefixedStyle(this.chromelessToolbar.style, 'borderRadius', '20px'); - mxUtils.setPrefixedStyle(this.chromelessToolbar.style, 'transition', 'opacity 600ms ease-in-out'); - } - + mxUtils.setPrefixedStyle(this.chromelessToolbar.style, 'borderRadius', '20px'); + mxUtils.setPrefixedStyle(this.chromelessToolbar.style, 'transition', 'opacity 600ms ease-in-out'); + var updateChromelessToolbarPosition = mxUtils.bind(this, function() { var css = mxUtils.getCurrentStyle(graph.container); diff --git a/examples/grapheditor/www/js/Graph.js b/examples/grapheditor/www/js/Graph.js index c625a1cad..508637f0a 100644 --- a/examples/grapheditor/www/js/Graph.js +++ b/examples/grapheditor/www/js/Graph.js @@ -7667,8 +7667,7 @@ if (typeof mxVertexHandler != 'undefined') pt.x, pt.y) && !mxUtils.isAncestorNode(state.text.node, mxEvent.getSource(evt))))) && ((state == null && !this.isCellLocked(this.getDefaultParent())) || (state != null && !this.isCellLocked(state.cell))) && - (state != null || (mxClient.IS_VML && src == this.view.getCanvas()) || - (mxClient.IS_SVG && src == this.view.getCanvas().ownerSVGElement))) + (state != null || (mxClient.IS_SVG && src == this.view.getCanvas().ownerSVGElement))) { if (state == null) { @@ -9932,14 +9931,7 @@ if (typeof mxVertexHandler != 'undefined') this.textarea.style.left = Math.round(this.bounds.x) + 'px'; this.textarea.style.top = Math.round(this.bounds.y) + 'px'; - if (mxClient.IS_VML) - { - this.textarea.style.zoom = scale; - } - else - { - mxUtils.setPrefixedStyle(this.textarea.style, 'transform', 'scale(' + scale + ',' + scale + ')'); - } + mxUtils.setPrefixedStyle(this.textarea.style, 'transform', 'scale(' + scale + ',' + scale + ')'); } else { diff --git a/examples/grapheditor/www/js/Sidebar.js b/examples/grapheditor/www/js/Sidebar.js index 24c1d508a..e8962e06f 100644 --- a/examples/grapheditor/www/js/Sidebar.js +++ b/examples/grapheditor/www/js/Sidebar.js @@ -2530,13 +2530,7 @@ Sidebar.prototype.createThumb = function(cells, width, height, parent, title, sh this.graph.getModel().clear(); mxClient.NO_FO = fo; - - // Catch-all event handling - if (mxClient.IS_IE6) - { - parent.style.backgroundImage = 'url(' + this.editorUi.editor.transparentImage + ')'; - } - + node.style.position = 'relative'; node.style.overflow = 'hidden'; node.style.left = this.thumbBorder + 'px'; @@ -2581,12 +2575,7 @@ Sidebar.prototype.createItem = function(cells, title, showLabel, showTitle, widt elt.style.width = (this.thumbWidth + border) + 'px'; elt.style.height = (this.thumbHeight + border) + 'px'; elt.style.padding = this.thumbPadding + 'px'; - - if (mxClient.IS_IE6) - { - elt.style.border = 'none'; - } - + // Blocks default click action mxEvent.addListener(elt, 'click', function(evt) { diff --git a/src/js/handler/mxConnectionHandler.js b/src/js/handler/mxConnectionHandler.js index 03db0226b..903127931 100644 --- a/src/js/handler/mxConnectionHandler.js +++ b/src/js/handler/mxConnectionHandler.js @@ -352,9 +352,9 @@ mouseDownCounter = 0; * * Switch to enable moving the preview away from the mousepointer. This is required in browsers * where the preview cannot be made transparent to events and if the built-in hit detection on - * the HTML elements in the page should be used. Default is the value of . + * the HTML elements in the page should be used. Default is false. */ -movePreviewAway = mxClient.IS_VML; +movePreviewAway = false; /** * Variable: outlineConnect diff --git a/src/js/handler/mxRubberband.js b/src/js/handler/mxRubberband.js index b88da1e2f..e7ee2de54 100644 --- a/src/js/handler/mxRubberband.js +++ b/src/js/handler/mxRubberband.js @@ -383,8 +383,8 @@ repaint = ()=> this.width = Math.max(this.first.x, x) - this.x; this.height = Math.max(this.first.y, y) - this.y; - var dx = (mxClient.IS_VML) ? this.graph.panDx : 0; - var dy = (mxClient.IS_VML) ? this.graph.panDy : 0; + var dx = 0; + var dy = 0; this.div.style.left = (this.x + dx) + 'px'; this.div.style.top = (this.y + dy) + 'px'; diff --git a/src/js/mxClient.js b/src/js/mxClient.js index 09ce2fd5a..6e24b048d 100644 --- a/src/js/mxClient.js +++ b/src/js/mxClient.js @@ -23,13 +23,6 @@ var mxClient = { */ VERSION: '4.2.2', - /** - * Variable: IS_IE6 - * - * True if the current browser is Internet Explorer 6.x. - */ - IS_IE6: navigator.userAgent != null && navigator.userAgent.indexOf('MSIE 6') >= 0, - /** * Variable: IS_EDGE * @@ -136,13 +129,6 @@ var mxClient = { (navigator.userAgent.indexOf('Iceape/') >= 0 && navigator.userAgent.indexOf('Iceape/1.') < 0), - /** - * Variable: IS_VML - * - * True if the browser supports VML. - */ - IS_VML: navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER', - /** * Variable: IS_SVG * @@ -214,7 +200,7 @@ var mxClient = { * Function: isBrowserSupported * * Returns true if the current browser is supported, that is, if - * or is true. + * is true. * * Example: * @@ -253,23 +239,19 @@ var mxClient = { doc = doc || document; // Workaround for Operation Aborted in IE6 if base tag is used in head - if (mxClient.IS_IE6) { - doc.write(''); - } else { - var link = doc.createElement('link'); + var link = doc.createElement('link'); - link.setAttribute('rel', rel); - link.setAttribute('href', href); - link.setAttribute('charset', 'UTF-8'); - link.setAttribute('type', 'text/css'); + link.setAttribute('rel', rel); + link.setAttribute('href', href); + link.setAttribute('charset', 'UTF-8'); + link.setAttribute('type', 'text/css'); - if (id) { - link.setAttribute('id', id); - } - - var head = doc.getElementsByTagName('head')[0]; - head.appendChild(link); + if (id) { + link.setAttribute('id', id); } + + var head = doc.getElementsByTagName('head')[0]; + head.appendChild(link); }, /** @@ -529,43 +511,6 @@ if (typeof(mxLanguages) != 'undefined' && mxLanguages != null) { mxClient.languages = mxLanguages; } -// Adds required namespaces, stylesheets and memory handling for older IE browsers -if (mxClient.IS_VML) { - if (mxClient.IS_SVG) { - mxClient.IS_VML = false; - } else { - // Enables support for IE8 standards mode. Note that this requires all attributes for VML - // elements to be set using direct notation, ie. node.attr = value, not setAttribute. - if (document.namespaces != null) { - if (document.documentMode == 8) { - document.namespaces.add(mxClient.VML_PREFIX, 'urn:schemas-microsoft-com:vml', '#default#VML'); - document.namespaces.add(mxClient.OFFICE_PREFIX, 'urn:schemas-microsoft-com:office:office', '#default#VML'); - } else { - document.namespaces.add(mxClient.VML_PREFIX, 'urn:schemas-microsoft-com:vml'); - document.namespaces.add(mxClient.OFFICE_PREFIX, 'urn:schemas-microsoft-com:office:office'); - } - } - - // Workaround for limited number of stylesheets in IE (does not work in standards mode) - if (mxClient.IS_QUIRKS && document.styleSheets.length >= 30) { - (() => { - var node = document.createElement('style'); - node.type = 'text/css'; - node.styleSheet.cssText = mxClient.VML_PREFIX + '\\:*{behavior:url(#default#VML)}' + - mxClient.OFFICE_PREFIX + '\\:*{behavior:url(#default#VML)}'; - document.getElementsByTagName('head')[0].appendChild(node); - })(); - } else { - document.createStyleSheet().cssText = mxClient.VML_PREFIX + '\\:*{behavior:url(#default#VML)}' + - mxClient.OFFICE_PREFIX + '\\:*{behavior:url(#default#VML)}'; - } - - if (mxLoadStylesheets) { - mxClient.link('stylesheet', mxClient.basePath + '/css/explorer.css'); - } - } -} - // PREPROCESSOR-REMOVE-START // If script is loaded via CommonJS, do not write