mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Treat acronyms like words in camel case names
No matter what the W3C says, getDomFromHtmlString is more legible than getDOMFromHTMLString. Change-Id: Ic843b6671871024cce8acd82b6be435599ed168b
This commit is contained in:
parent
3be13a7cbc
commit
8511f8ab3e
|
@ -332,7 +332,7 @@ ve.dm.Converter.prototype.createDataElements = function ( modelClass, domElement
|
|||
* @returns {HTMLElement} HTML DOM node
|
||||
*/
|
||||
ve.dm.Converter.prototype.getDomElementFromDataAnnotation = function ( dataAnnotation, doc ) {
|
||||
var htmlData = dataAnnotation.toHTML(),
|
||||
var htmlData = dataAnnotation.toHtml(),
|
||||
domElement = doc.createElement( htmlData.tag );
|
||||
|
||||
ve.setDomAttributes( domElement, htmlData.attributes );
|
||||
|
@ -897,7 +897,7 @@ ve.dm.Converter.prototype.getDataFromDomRecursion = function ( domElement, wrapp
|
|||
* @returns {HTMLDocument} Document containing the resulting HTML
|
||||
*/
|
||||
ve.dm.Converter.prototype.getDomFromData = function ( documentData, store, internalList ) {
|
||||
var doc = ve.createDocumentFromHTML( '' );
|
||||
var doc = ve.createDocumentFromHtml( '' );
|
||||
|
||||
// Set up the converter state
|
||||
this.documentData = documentData;
|
||||
|
|
|
@ -157,7 +157,7 @@ ve.init.mw.Target.onLoad = function ( response ) {
|
|||
);
|
||||
} else {
|
||||
this.originalHtml = data.content;
|
||||
this.doc = ve.createDocumentFromHTML( this.originalHtml );
|
||||
this.doc = ve.createDocumentFromHtml( this.originalHtml );
|
||||
|
||||
/* Don't show notices with no visible html (bug 43013). */
|
||||
|
||||
|
@ -701,14 +701,17 @@ ve.init.mw.Target.prototype.reportProblem = function ( message ) {
|
|||
'diff': this.diffHtml,
|
||||
'originalHtml': this.originalHtml,
|
||||
'originalData':
|
||||
// originalHTML only has the body's HTML for now, see TODO comment in ve.init.mw.ViewPageTarget.prototype.setupSurface
|
||||
// originalHtml only has the body's HTML for now, see TODO comment in
|
||||
// ve.init.mw.ViewPageTarget.prototype.setupSurface
|
||||
// FIXME: need to expand this data before sending it, see bug 47319
|
||||
ve.dm.converter.getDataFromDom(
|
||||
ve.createDocumentFromHTML( '<body>' + this.originalHtml + '</body>' ),
|
||||
ve.createDocumentFromHtml( '<body>' + this.originalHtml + '</body>' ),
|
||||
store, internalList
|
||||
).getData(),
|
||||
'editedData': editedData,
|
||||
'editedHtml': this.getHtml( ve.dm.converter.getDomFromData( editedData, store, internalList ) ),
|
||||
'editedHtml': this.getHtml(
|
||||
ve.dm.converter.getDomFromData( editedData, store, internalList )
|
||||
),
|
||||
'store': doc.data.getUsedStoreValues(),
|
||||
'wiki': mw.config.get( 'wgDBname' )
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
* @example
|
||||
* new ve.init.sa.Target(
|
||||
* $( '<div>' ).appendTo( 'body' ), ve.createDocumentFromHTML( '<p>Hello world.</p>' )
|
||||
* $( '<div>' ).appendTo( 'body' ), ve.createDocumentFromHtml( '<p>Hello world.</p>' )
|
||||
* );
|
||||
*
|
||||
* @class
|
||||
|
|
|
@ -64,7 +64,9 @@ QUnit.test( 'getDataFromDom', function ( assert ) {
|
|||
internalList = new ve.dm.InternalList();
|
||||
ve.dm.example.preprocessAnnotations( cases[msg].data, store );
|
||||
assert.deepEqualWithDomElements(
|
||||
ve.dm.converter.getDataFromDom( ve.createDocumentFromHTML( cases[msg].html ), store, internalList ).getData(),
|
||||
ve.dm.converter.getDataFromDom(
|
||||
ve.createDocumentFromHtml( cases[msg].html ), store, internalList
|
||||
).getData(),
|
||||
cases[msg].data,
|
||||
msg
|
||||
);
|
||||
|
@ -107,7 +109,7 @@ QUnit.test( 'getDomFromData', function ( assert ) {
|
|||
originalData = ve.copyArray( doc.getFullData() );
|
||||
assert.equalDomElement(
|
||||
ve.dm.converter.getDomFromData( doc.getFullData(), doc.getStore(), doc.getInternalList() ),
|
||||
ve.createDocumentFromHTML( cases[msg].normalizedHtml || cases[msg].html ),
|
||||
ve.createDocumentFromHtml( cases[msg].normalizedHtml || cases[msg].html ),
|
||||
msg
|
||||
);
|
||||
assert.deepEqualWithDomElements( doc.getFullData(), originalData, msg + ' (data hasn\'t changed)' );
|
||||
|
|
|
@ -3173,7 +3173,7 @@ ve.dm.example.domToDataCases = {
|
|||
}
|
||||
};
|
||||
|
||||
ve.dm.example.isolationHTML =
|
||||
ve.dm.example.isolationHtml =
|
||||
'<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>' +
|
||||
'Paragraph' +
|
||||
'<ul><li>Item 4</li><li>Item 5</li><li>Item 6</li></ul>' +
|
||||
|
|
|
@ -11,7 +11,7 @@ QUnit.module( 've.ui.FormatAction' );
|
|||
|
||||
function runFormatConverterTest( assert, range, type, attributes, expectedSelection, expectedData, msg ) {
|
||||
var selection,
|
||||
dom = ve.createDocumentFromHTML( ve.dm.example.isolationHTML ),
|
||||
dom = ve.createDocumentFromHtml( ve.dm.example.isolationHtml ),
|
||||
target = new ve.init.sa.Target( $( '#qunit-fixture' ), dom ),
|
||||
surface = target.surface,
|
||||
formatAction = new ve.ui.FormatAction( surface ),
|
||||
|
|
|
@ -11,7 +11,7 @@ QUnit.module( 've.ui.IndentationAction' );
|
|||
|
||||
function runIndentationChangeTest( assert, range, method, expectedSelection, expectedData, expectedOriginalData, msg ) {
|
||||
var selection,
|
||||
dom = ve.createDocumentFromHTML( ve.dm.example.isolationHTML ),
|
||||
dom = ve.createDocumentFromHtml( ve.dm.example.isolationHtml ),
|
||||
target = new ve.init.sa.Target( $( '#qunit-fixture' ), dom ),
|
||||
surface = target.surface,
|
||||
indentationAction = new ve.ui.IndentationAction( surface ),
|
||||
|
|
|
@ -11,7 +11,7 @@ QUnit.module( 've.ui.ListAction' );
|
|||
|
||||
function runListConverterTest( assert, html, method, style, range, expectedSelection, expectedData, expectedOriginalData, msg ) {
|
||||
var selection,
|
||||
dom = ve.createDocumentFromHTML( html || ve.dm.example.html ),
|
||||
dom = ve.createDocumentFromHtml( html || ve.dm.example.html ),
|
||||
target = new ve.init.sa.Target( $( '#qunit-fixture' ), dom ),
|
||||
surface = target.surface,
|
||||
listAction = new ve.ui.ListAction( surface ),
|
||||
|
@ -52,7 +52,7 @@ QUnit.test( '(un)wrap', function ( assert ) {
|
|||
'msg': 'wrapping two paragraphs in a list'
|
||||
},
|
||||
{
|
||||
'html': ve.dm.example.isolationHTML,
|
||||
'html': ve.dm.example.isolationHtml,
|
||||
'range': new ve.Range( 191, 211 ),
|
||||
'method': 'unwrap',
|
||||
'style': 'bullet',
|
||||
|
|
|
@ -823,7 +823,7 @@ QUnit.test( 'batchSplice', 8, function ( assert ) {
|
|||
assert.deepEqual( expected, actual, 'replacing 3 elements with 2100 elements (array)' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'createDocumentFromHTML', function ( assert ) {
|
||||
QUnit.test( 'createDocumentFromHtml', function ( assert ) {
|
||||
var key, doc, expectedHead, expectedBody,
|
||||
cases = [
|
||||
{
|
||||
|
@ -853,7 +853,7 @@ QUnit.test( 'createDocumentFromHTML', function ( assert ) {
|
|||
];
|
||||
QUnit.expect( cases.length*2 );
|
||||
for ( key in cases ) {
|
||||
doc = ve.createDocumentFromHTML( cases[key].html );
|
||||
doc = ve.createDocumentFromHtml( cases[key].html );
|
||||
expectedHead = $( '<head>' ).html( cases[key].head ).get( 0 );
|
||||
expectedBody = $( '<body>' ).html( cases[key].body ).get( 0 );
|
||||
assert.equalDomElement( $( 'head', doc ).get( 0 ), expectedHead, cases[key].msg + ' (head)' );
|
||||
|
|
|
@ -1068,10 +1068,10 @@
|
|||
* @param {string} html HTML string
|
||||
* @returns {HTMLDocument} Document constructed from the HTML string
|
||||
*/
|
||||
ve.createDocumentFromHTML = function ( html ) {
|
||||
ve.createDocumentFromHtml = function ( html ) {
|
||||
// Here's how this function should look:
|
||||
//
|
||||
// var newDocument = document.implementation.createHTMLDocument( '' );
|
||||
// var newDocument = document.implementation.createHtmlDocument( '' );
|
||||
// newDocument.open();
|
||||
// newDocument.write( html );
|
||||
// newDocument.close();
|
||||
|
|
Loading…
Reference in a new issue