diff src/formats/bbcode.js @ 25:80bf0adc9efd

remove format oo
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 09 Aug 2022 23:15:58 -0600
parents 80a86fb8f2b7
children 160be99e1517
line wrap: on
line diff
--- a/src/formats/bbcode.js	Tue Aug 09 22:49:59 2022 -0600
+++ b/src/formats/bbcode.js	Tue Aug 09 23:15:58 2022 -0600
@@ -1024,8 +1024,8 @@
 	 * @name BBCodeParser
 	 * @since v1.4.0
 	 */
-	function BBCodeParser(options) {
-		var base = this;
+	function newBBCodeParser(options) {
+		var base = {};
 
 		base.opts = extend({}, BBCodeParser.defaults, options);
 
@@ -2065,8 +2065,12 @@
 		function lower(str) {
 			return str.toLowerCase();
 		}
+
+		return base;
 	};
 
+	var BBCodeParser = {};
+
 	/**
 	 * Quote type
 	 * @type {Object}
@@ -2213,7 +2217,7 @@
 	 * @since 2.0.0
 	 */
 	function bbcodeFormat() {
-		var base = this;
+		var base = {};
 
 		base.stripQuotes = _stripQuotes;
 
@@ -2522,7 +2526,7 @@
 		 * @param {boolean} [legacyAsFragment] Used by fromBBCode() method
 		 */
 		function toHtml(asFragment, source, legacyAsFragment) {
-			var	parser = new BBCodeParser(base.opts.parserOptions);
+			var	parser = newBBCodeParser(base.opts.parserOptions);
 			var html = parser.toHTML(
 				base.opts.bbcodeTrim ? source.trim() : source
 			);
@@ -2547,7 +2551,7 @@
 			var	bbcode, elements;
 			var containerParent = context.createElement('div');
 			var container = context.createElement('div');
-			var parser = new BBCodeParser(base.opts.parserOptions);
+			var parser = newBBCodeParser(base.opts.parserOptions);
 
 			container.innerHTML = html;
 			css(containerParent, 'visibility', 'hidden');
@@ -2594,6 +2598,8 @@
 		base.fragmentToHtml = toHtml.bind(null, true);
 		base.toSource = toSource.bind(null, false);
 		base.fragmentToSource = toSource.bind(null, true);
+
+		return base;
 	};
 
 	/**