Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/279728

Change subject: dm.Document#newFromHtml: Allow HTMLDocument argument as well as 
string
......................................................................

dm.Document#newFromHtml: Allow HTMLDocument argument as well as string

Change-Id: I24250845e97acb4b7de9c495cb46dbd28fc8817e
---
M src/dm/ve.dm.Document.js
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/28/279728/1

diff --git a/src/dm/ve.dm.Document.js b/src/dm/ve.dm.Document.js
index f4865f6..ea689f3 100644
--- a/src/dm/ve.dm.Document.js
+++ b/src/dm/ve.dm.Document.js
@@ -1303,12 +1303,12 @@
  * Create a document given an HTML string.
  *
  * @method
- * @param {string} html HTML to insert
+ * @param {string|HTMLDocument} html HTML string or document to insert
  * @param {Object} [importRules] The import rules with which to sanitize the 
HTML, if importing
  * @return {ve.dm.Document} New document
  */
 ve.dm.Document.prototype.newFromHtml = function ( html, importRules ) {
-       var htmlDoc = ve.createDocumentFromHtml( html ),
+       var htmlDoc = typeof html === 'string' ? ve.createDocumentFromHtml( 
html ) : html,
                doc = ve.dm.converter.getModelFromDom( htmlDoc, {
                        targetDoc: this.getHtmlDocument(),
                        fromClipboard: !!importRules

-- 
To view, visit https://gerrit.wikimedia.org/r/279728
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24250845e97acb4b7de9c495cb46dbd28fc8817e
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

Reply via email to