Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/283697
Change subject: Add 'Support: [browser]' to browser hack comments
......................................................................
Add 'Support: [browser]' to browser hack comments
Change-Id: I0daafbc12efd0d6e2e327303b3c12b215c984b21
---
M src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
M src/ce/nodes/ve.ce.TableNode.js
M src/ce/selections/ve.ce.LinearSelection.js
M src/ce/styles/annotations/ve.ce.LanguageAnnotation.css
M src/ce/styles/nodes/ve.ce.BranchNode.css
M src/ce/styles/nodes/ve.ce.FocusableNode.css
M src/ce/styles/ve.ce.Surface.css
M src/ce/ve.ce.BranchNode.js
M src/ce/ve.ce.FocusableNode.js
M src/ce/ve.ce.Surface.js
M src/dm/lineardata/ve.dm.ElementLinearData.js
M src/dm/ve.dm.BranchNode.js
M src/dm/ve.dm.LinearData.js
M src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js
M src/ui/inspectors/ve.ui.FragmentInspector.js
M src/ui/styles/dialogs/ve.ui.FindAndReplaceDialog.css
M src/ve.debug.js
M src/ve.utils.js
18 files changed, 46 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/97/283697/1
diff --git a/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
b/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
index 3290ad9..f57abf6 100644
--- a/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
+++ b/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
@@ -155,6 +155,7 @@
surface.eventSequencer.afterOne( { keydown: function () {
var viewNode, newRange, afterDirection;
+ // Support: Chrome
// Chrome bug lets you cursor into a multi-line
contentEditable=false with up/down...
viewNode = $( surface.nativeSelection.focusNode ).closest(
'.ve-ce-leafNode,.ve-ce-branchNode' ).data( 'view' );
if ( !viewNode ) {
diff --git a/src/ce/nodes/ve.ce.TableNode.js b/src/ce/nodes/ve.ce.TableNode.js
index 2fe20a2..d7462dc 100644
--- a/src/ce/nodes/ve.ce.TableNode.js
+++ b/src/ce/nodes/ve.ce.TableNode.js
@@ -291,7 +291,8 @@
}
this.$element.toggleClass( 've-ce-tableNode-editing', isEditing );
- // HACK T103035: Firefox 39 has a regression which clicking on a
ce=false table
+ // Support: Firefox 39
+ // HACK T103035: Firefox 39 has a regression in which clicking on a
ce=false table
// always selects the entire table, even if you click in a ce=true
child.
// Making the table ce=true does allow the user to make selections
across cells
// and corrupt the table in some circumstance, so restrict this hack as
much
diff --git a/src/ce/selections/ve.ce.LinearSelection.js
b/src/ce/selections/ve.ce.LinearSelection.js
index 89270ad..a6b187b 100644
--- a/src/ce/selections/ve.ce.LinearSelection.js
+++ b/src/ce/selections/ve.ce.LinearSelection.js
@@ -52,6 +52,7 @@
return null;
}
+ // Support: Firefox
// Calling getClientRects sometimes fails:
// * in Firefox on page load when the address bar is still focused
// * in empty paragraphs
diff --git a/src/ce/styles/annotations/ve.ce.LanguageAnnotation.css
b/src/ce/styles/annotations/ve.ce.LanguageAnnotation.css
index e886de6..0718b26 100644
--- a/src/ce/styles/annotations/ve.ce.LanguageAnnotation.css
+++ b/src/ce/styles/annotations/ve.ce.LanguageAnnotation.css
@@ -9,6 +9,7 @@
background-color: #ebf3f5;
}
+/* Support: IE */
/* Don't apply a background color to language annotations, otherwise the
text disappears if the span has dir="rtl" */
.ve-init-target-ie .ve-ce-languageAnnotation {
diff --git a/src/ce/styles/nodes/ve.ce.BranchNode.css
b/src/ce/styles/nodes/ve.ce.BranchNode.css
index 4e16852..4c94e73 100644
--- a/src/ce/styles/nodes/ve.ce.BranchNode.css
+++ b/src/ce/styles/nodes/ve.ce.BranchNode.css
@@ -82,6 +82,7 @@
/* Pre-formatted node styling */
pre.ve-ce-branchNode {
+ /* Support: Chrome, Safari */
/* Prevent silly wrapping on Safari and Chrome
(https://bugs.webkit.org/show_bug.cgi?id=35935) */
word-wrap: normal;
}
diff --git a/src/ce/styles/nodes/ve.ce.FocusableNode.css
b/src/ce/styles/nodes/ve.ce.FocusableNode.css
index 20b9e5b..a3f86eb 100644
--- a/src/ce/styles/nodes/ve.ce.FocusableNode.css
+++ b/src/ce/styles/nodes/ve.ce.FocusableNode.css
@@ -12,6 +12,7 @@
opacity: 0.15;
}
+/* Support: IE */
/* Set opacity directly on the highlights, rather than their containers,
otherwise the opacity isn't applied at all */
.ve-init-target-ie .ve-ce-surface-highlights-focused
.ve-ce-focusableNode-highlight {
@@ -30,6 +31,7 @@
children in Firefox. */
/*csslint vendor-prefix: false, compatible-vendor-prefixes:false */
.ve-ce-focusableNode * {
+ /* Support: Firefox */
/* T70537: work around Firefox bug */
-moz-user-select: none;
}
diff --git a/src/ce/styles/ve.ce.Surface.css b/src/ce/styles/ve.ce.Surface.css
index 7a1d4fb..6c7d169 100644
--- a/src/ce/styles/ve.ce.Surface.css
+++ b/src/ce/styles/ve.ce.Surface.css
@@ -33,6 +33,7 @@
background: #000;
}
+/* Support: IE */
/* Set opacity directly on the highlights, rather than their containers,
otherwise the opacity isn't applied at all */
.ve-init-target-ie .ve-ce-surface-deactivatedSelection > div {
@@ -68,6 +69,7 @@
height: 1px !important;
}
+/* Support: IE */
/* Prevent IE from wrapping link text in <u> and <font color> tags */
.ve-init-target-ie .ve-ce-surface-paste a {
text-decoration: underline !important;
diff --git a/src/ce/ve.ce.BranchNode.js b/src/ce/ve.ce.BranchNode.js
index b4eb391..89822b9 100644
--- a/src/ce/ve.ce.BranchNode.js
+++ b/src/ce/ve.ce.BranchNode.js
@@ -68,6 +68,7 @@
.addClass( 've-ce-branchNode-slug
ve-ce-branchNode-inlineSlug' )
.append( $img );
+ // Support: Firefox
// Firefox misbehaves if we don't set an src:
https://bugzilla.mozilla.org/show_bug.cgi?id=989012
// But setting an src in Chrome is very slow, so only set it in Firefox
if ( layout === 'gecko' ) {
diff --git a/src/ce/ve.ce.FocusableNode.js b/src/ce/ve.ce.FocusableNode.js
index d2856b3..7307ac2 100644
--- a/src/ce/ve.ce.FocusableNode.js
+++ b/src/ce/ve.ce.FocusableNode.js
@@ -525,6 +525,7 @@
columnCount = $el.css( '-webkit-column-count' );
columnWidth = $el.css( '-webkit-column-width' );
if ( ( columnCount && columnCount !== 'auto' ) || (
columnWidth && columnWidth !== 'auto' ) ) {
+ // Support: Chrome
// Chrome incorrectly measures children of
nodes with columns [1], let's
// just ignore them rather than render a
possibly bizarre highlight. They
// will usually not be positioned, because
Chrome also doesn't position
diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 9f3dfcc..c16c336 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -162,6 +162,7 @@
} );
// Initialization
+ // Support: Chrome
// Add 'notranslate' class to prevent Chrome's translate feature from
// completely messing up the CE DOM (T59124)
this.$element.addClass( 've-ce-surface notranslate' );
@@ -236,6 +237,7 @@
* @type {string[]}
*/
ve.ce.Surface.static.unsafeAttributes = [
+ // Support: Firefox
// RDFa: Firefox ignores these
'about',
'content',
@@ -317,6 +319,7 @@
// Disconnect DOM events on the window
this.$window.off( 'resize', this.onWindowResizeHandler );
+ // Support: Firefox, iOS
// FIXME T126041: Blur to make selection/cursor disappear (needed in
Firefox
// in some cases, and in iOS to hide the keyboard)
if ( this.isFocused() ) {
@@ -465,6 +468,7 @@
// but onDocumentFocus won't fire so restore the selection here too.
this.onModelSelect();
setTimeout( function () {
+ // Support: Chrome
// In some browsers (e.g. Chrome) giving the document node
focus doesn't
// necessarily give you a selection (e.g. if the first child is
a <figure>)
// so if the surface isn't 'focused' (has no selection) give it
a selection
@@ -499,6 +503,7 @@
* @param {jQuery.Event} e focusin/out event
*/
ve.ce.Surface.prototype.onDocumentFocusInOut = function ( e ) {
+ // Support: IE11
// Filter out focusin/out events on iframes
// IE11 emits these when the focus moves into/out of an iframed
document,
// but these events are misleading because the focus in this document
didn't
@@ -686,6 +691,7 @@
// so poll in the 'after' function
setTimeout( this.afterDocumentMouseDown.bind( this, e,
this.getSelection() ) );
+ // Support: IE
// Handle triple click
// FIXME T126043: do not do triple click handling in IE, because their
click counting is broken
if ( e.originalEvent.detail >= 3 &&
!ve.init.platform.constructor.static.isInternetExplorer() ) {
@@ -758,6 +764,7 @@
/**
* Fix shift-click selection
*
+ * Support: Chrome
* When shift-clicking on links Chrome tries to collapse the selection
* so check for this and fix manually.
*
@@ -811,6 +818,7 @@
try {
dataTransfer.setData( 'application-x/VisualEditor',
JSON.stringify( this.getModel().getSelection() ) );
} catch ( err ) {
+ // Support: IE
// IE doesn't support custom data types, but overwriting the
actual drag data should be avoided
// TODO: Do this with an internal state to avoid overwriting
drag data even in IE
dataTransfer.setData( 'text', '__ve__' + JSON.stringify(
this.getModel().getSelection() ) );
@@ -857,6 +865,7 @@
break;
}
}
+ // Support: Firefox
// If we have no metadata (e.g. in Firefox) assume it
is droppable
} else if ( Array.prototype.indexOf.call(
dataTransfer.types || [], 'Files' ) !== -1 ) {
this.allowedFile = true;
@@ -1061,7 +1070,8 @@
}
if ( e.which === 229 ) {
- // Ignore fake IME events (emitted in IE and Chromium)
+ // Support: IE, Chrome
+ // Ignore fake IME events (emitted in IE and Chrome)
return;
}
@@ -1576,6 +1586,7 @@
return ve.resolveUrl( href, htmlDoc );
} );
+ // Support: Firefox
// Some attributes (e.g RDFa attributes in Firefox) aren't preserved by
copy
unsafeSelector = '[' + ve.ce.Surface.static.unsafeAttributes.join(
'],[' ) + ']';
this.$pasteTarget.find( unsafeSelector ).each( function () {
@@ -2129,6 +2140,7 @@
right--;
context.splice( context.getLength() - 1, 1 );
}
+ // Support: Chrome
// FIXME T126046: Strip trailing linebreaks probably
introduced by Chrome bug
while ( right > 0 && data.getType( right - 1 ) ===
'break' ) {
right--;
@@ -2324,6 +2336,7 @@
this.model.selection instanceof ve.dm.TableSelection &&
$.client.profile().layout === 'gecko'
) {
+ // Support: Firefox
// Work around a segfault on blur+focus in Firefox
compositionstart handlers.
// It would get triggered by handleInsertion emptying the table
cell then putting
// a linear selection inside it. See:
@@ -2648,6 +2661,7 @@
/*jshint bitwise: true*/
}
+ // Support: Firefox
// Firefox lets you create multiple selections within a single
paragraph
// which our model doesn't support, so detect and prevent these.
// This shouldn't create problems with IME candidates as only
an explicit user
@@ -2754,6 +2768,7 @@
node = fixedPosition.node;
offset = fixedPosition.offset;
if ( direction === -1 ) {
+ // Support: Firefox
// Moving startwards: left-bias the fixed position
// Avoids Firefox bug "cursor disappears at left of img inside
link":
// https://bugzilla.mozilla.org/show_bug.cgi?id=1175495
@@ -3248,6 +3263,7 @@
sel.extend( newSel.focusNode,
newSel.focusOffset );
extendedBackwards = true;
} catch ( e ) {
+ // Support: Firefox
// Firefox sometimes fails when nodes are
different
// see
https://bugzilla.mozilla.org/show_bug.cgi?id=921444
}
diff --git a/src/dm/lineardata/ve.dm.ElementLinearData.js
b/src/dm/lineardata/ve.dm.ElementLinearData.js
index 3591888..6ac9362 100644
--- a/src/dm/lineardata/ve.dm.ElementLinearData.js
+++ b/src/dm/lineardata/ve.dm.ElementLinearData.js
@@ -1115,6 +1115,7 @@
contentElement = isOpen ? this.getData( i ) :
null;
}
} else {
+ // Support: Firefox
// Remove plain newline characters, as they are
semantically meaningless
// and will confuse the user. Firefox adds these
automatically when copying
// line-wrapped HTML. T104790
diff --git a/src/dm/ve.dm.BranchNode.js b/src/dm/ve.dm.BranchNode.js
index 843c1b8..6338639 100644
--- a/src/dm/ve.dm.BranchNode.js
+++ b/src/dm/ve.dm.BranchNode.js
@@ -167,6 +167,7 @@
return;
}
+ // Support: Firefox
// If this content branch no longer has any non-internal items, insert
a slug to keep the node
// from becoming invisible/unfocusable. In Firefox, backspace after
Ctrl+A leaves the document
// completely empty, so this ensures DocumentNode gets a slug.
diff --git a/src/dm/ve.dm.LinearData.js b/src/dm/ve.dm.LinearData.js
index b01656d..5132057 100644
--- a/src/dm/ve.dm.LinearData.js
+++ b/src/dm/ve.dm.LinearData.js
@@ -231,6 +231,7 @@
start = Math.max( 0, Math.min( length, range.start ) );
end = Math.max( 0, Math.min( length, range.end ) );
}
+ // Support: IE
// IE work-around: arr.slice( 0, undefined ) returns [] while
arr.slice( 0 ) behaves correctly
data = end === undefined ? this.slice( start ) : this.slice( start, end
);
// Return either the slice or a deep copy of the slice
diff --git a/src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js
b/src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js
index 217157c..6db1d2d 100644
--- a/src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js
+++ b/src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js
@@ -31,6 +31,7 @@
ve.ui.UrlStringTransferHandler.static.types = [
// DnD standard, no title information
'text/uri-list',
+ // Support: Firefox
// Firefox type, preserves title
'text/x-moz-url',
// Used in GNOME drag-and-drop
@@ -97,7 +98,8 @@
.split( /[\r\n]+/g ).map( function ( line ) {
return { href: line };
} );
- // When Google Chrome uses this mime type the link
titles can
+ // Support: Chrome
+ // When Chrome uses this mime type the link titles can
// be extracted from the 'text/html' version of the
item.
// Let's try that.
if ( this.item.data.htmlStringData ) {
diff --git a/src/ui/inspectors/ve.ui.FragmentInspector.js
b/src/ui/inspectors/ve.ui.FragmentInspector.js
index baecf52..c46d836 100644
--- a/src/ui/inspectors/ve.ui.FragmentInspector.js
+++ b/src/ui/inspectors/ve.ui.FragmentInspector.js
@@ -167,6 +167,7 @@
* @inheritdoc
*/
ve.ui.FragmentInspector.prototype.getBodyHeight = function () {
+ // Support: Chrome
// FIXME T126027: Chrome gets the height wrong by 1px for elements with
opacity < 1
// e.g. a disabled button.
return Math.ceil( this.container.$element[ 0 ].scrollHeight ) + 1;
diff --git a/src/ui/styles/dialogs/ve.ui.FindAndReplaceDialog.css
b/src/ui/styles/dialogs/ve.ui.FindAndReplaceDialog.css
index 8256f97..92e6a78 100644
--- a/src/ui/styles/dialogs/ve.ui.FindAndReplaceDialog.css
+++ b/src/ui/styles/dialogs/ve.ui.FindAndReplaceDialog.css
@@ -62,6 +62,7 @@
background: #1f850b;
}
+/* Support: IE */
/* Set opacity directly on the highlights, rather than their containers,
otherwise the opacity isn't applied at all */
.ve-init-target-ie .ve-ui-findAndReplaceDialog-findResult > div {
diff --git a/src/ve.debug.js b/src/ve.debug.js
index e004560..aacc6c0 100644
--- a/src/ve.debug.js
+++ b/src/ve.debug.js
@@ -26,6 +26,7 @@
* @param {...Mixed} [data] Data to log
*/
ve.log = function () {
+ // Support: IE9
// In IE9 console methods are not real functions and as such do not
inherit
// from Function.prototype, thus console.log.apply does not exist.
// However it is function-like enough that passing it to Function#apply
does work.
@@ -39,6 +40,7 @@
* @param {...Mixed} [data] Data to log
*/
ve.error = function () {
+ // Support: IE9
// In IE9 console methods are not real functions and as such do not
inherit
// from Function.prototype, thus console.error.apply does not exist.
// However it is function-like enough that passing it to Function#apply
does work.
diff --git a/src/ve.utils.js b/src/ve.utils.js
index 1be1973..032bc55 100644
--- a/src/ve.utils.js
+++ b/src/ve.utils.js
@@ -759,6 +759,7 @@
ve.createDocumentFromHtmlUsingDomParser = function ( html ) {
var newDocument;
+ // Support: IE
// IE doesn't like empty strings
html = html || '<body></body>';
@@ -1064,6 +1065,7 @@
ve.normalizeAttributeValue = function ( name, value, nodeName ) {
var node = document.createElement( nodeName || 'div' );
node.setAttribute( name, value );
+ // Support: IE
// IE normalizes invalid CSS to empty string, then if you normalize
// an empty string again it becomes null. Return an empty string
// instead of null to make this function idempotent.
@@ -1083,11 +1085,13 @@
ve.transformStyleAttributes = function ( html, unmask ) {
var xmlDoc, fromAttr, toAttr, i, len,
maskAttrs = [
+ // Support: IE
'style', // IE normalizes 'color:#ffd' to 'color:
rgb(255, 255, 221);'
'bgcolor', // IE normalizes '#FFDEAD' to '#ffdead'
'color', // IE normalizes 'Red' to 'red'
'width', // IE normalizes '240px' to '240'
'height', // Same as width
+ // Support: Firefox
'rowspan', // IE and Firefox normalize rowspan="02" to
rowspan="2"
'colspan' // Same as rowspan
];
@@ -1140,6 +1144,7 @@
* @return {HTMLDocument} HTML DOM
*/
ve.parseXhtml = function ( html ) {
+ // Support: IE
// Feature-detect style attribute breakage in IE
if ( ve.isStyleAttributeBroken === undefined ) {
ve.isStyleAttributeBroken = ve.normalizeAttributeValue(
'style', 'color:#ffd' ) !== 'color:#ffd';
@@ -1159,6 +1164,7 @@
*/
ve.serializeXhtml = function ( doc ) {
var xml;
+ // Support: IE
// Feature-detect style attribute breakage in IE
if ( ve.isStyleAttributeBroken === undefined ) {
ve.isStyleAttributeBroken = ve.normalizeAttributeValue(
'style', 'color:#ffd' ) !== 'color:#ffd';
@@ -1184,6 +1190,7 @@
ve.normalizeNode = function ( node ) {
var p, nodeIterator, textNode;
if ( ve.isNormalizeBroken === undefined ) {
+ // Support: IE11
// Feature-detect IE11's broken .normalize() implementation.
// We know that it fails to remove the empty text node at the
end
// in this example, but for mysterious reasons it also fails to
merge
--
To view, visit https://gerrit.wikimedia.org/r/283697
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0daafbc12efd0d6e2e327303b3c12b215c984b21
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits