mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix jsdom polyfill
This commit is contained in:
parent
17222b3d5a
commit
410b453049
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -359,7 +359,7 @@ showdown.Converter = function (converterOptions) {
|
|||
// ex: <em>this is</em> <strong>sparta</strong>
|
||||
src = src.replace(/>[ \t]+</, '>¨NBSP;<');
|
||||
|
||||
var doc = document.createElement('div');
|
||||
var doc = showdown.helper.document.createElement('div');
|
||||
doc.innerHTML = src;
|
||||
|
||||
var preList = substitutePreCodeTags(doc);
|
||||
|
|
|
@ -6,6 +6,11 @@ if (!showdown.hasOwnProperty('helper')) {
|
|||
showdown.helper = {};
|
||||
}
|
||||
|
||||
if (typeof this.document === 'undefined' && typeof this.window === 'undefined') {
|
||||
this.window = require('jsdom').jsdom('', {}).defaultView; // jshint ignore:line
|
||||
}
|
||||
showdown.helper.document = this.window.document;
|
||||
|
||||
/**
|
||||
* Check if var is string
|
||||
* @static
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
/**
|
||||
* Created by Tivie on 06-01-2015.
|
||||
*/
|
||||
|
||||
// load dependencies
|
||||
if (typeof document === 'undefined' && typeof window === 'undefined') {
|
||||
var jsdom = require('jsdom').jsdom,
|
||||
jsdomObj = jsdom('', {}),
|
||||
window = jsdomObj.defaultView, // jshint ignore:line
|
||||
document = window.document; // jshint ignore:line
|
||||
}
|
||||
|
||||
// Private properties
|
||||
var showdown = {},
|
||||
parsers = {},
|
||||
|
|
Loading…
Reference in New Issue
Block a user