Skip to content

Commit 503f83c

Browse files
committed
Undoes Byte Order Mark change.
1 parent 5161ec5 commit 503f83c

3 files changed

Lines changed: 7 additions & 44 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###### This is released software. Please **[log issues](https://github.com/ptrdo/microdata-template/issues)** found.
2-
# microdata-template `v2.3.0`
2+
# microdata-template `v2.2.2`
33
An implementation of HTML template by way of the microdata mechanism.
44
### The Gist
55
This JavaScript module should simplify adding dynamic content to HTML documents while staying true to the recommendations of web standards. There are no dependencies here except the JavaScript [ECMA5 standard](http://www.ecma-international.org/ecma-262/5.1/) which enjoys [nearly universal support](http://kangax.github.io/compat-table/es5/) in modern browsers. Also, since the HTML recommendations for integral technologies such as [template](https://www.w3.org/TR/html52/semantics-scripting.html#the-template-element) and [microdata](https://www.w3.org/TR/microdata/) are variably implemented by modern browsers, this module serves as a [polyfill](https://en.wikipedia.org/wiki/Polyfill) to assure reliable results. Best of all, this methodology encourages the writing of low-dependency JavaScript and perfectly valid HTML — even within fully-functional templated markup.
@@ -260,11 +260,11 @@ Once instantiated in the web client code, the microdata-template can be addresse
260260
```javascript
261261
// In pre-ES6 implementations, the code is exposed to the global namespace:
262262
var templater = window.MicrodataTemplate.init();
263-
templater.getVerson(); // returns current version, e.g. "2.3.0"
263+
templater.getVerson(); // returns current version, e.g. "2.2.2"
264264

265265
// In ES6 implementations, the import code does not require init()
266266
import templater from "./path/to/microdata-template.js";
267-
templater.getVersion(); // returns current version, e.g. "2.3.0"
267+
templater.getVersion(); // returns current version, e.g. "2.2.2"
268268

269269
// Defaults are assumed, but configuration can be passed to init:
270270
templater.init({

lib/microdata-template.js

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @author Peter Sylwester
99
* @copyright (c)2022 Peter Sylwester
1010
* @license MIT
11-
* @version 2.3.0, 2022/05/03
11+
* @version 2.2.2, 2022/05/03
1212
* @requires "HTML5", "ECMA-262 Edition 5.1"
1313
*
1414
*
@@ -188,14 +188,6 @@
188188
* @type {Boolean} When true, requires Microdata attributes for template.
189189
*/
190190
var strictStandard = false;
191-
192-
/**
193-
* stripByteOrderMark removes the marking indicating UTF-8 encoding.
194-
*
195-
* @public via proxy
196-
* @type {Boolean} When true, strips Byte Order Mark from incoming HTML snippets.
197-
*/
198-
var stripByteOrderMark = true;
199191

200192
/* PRIVATE UTILITIES */
201193

@@ -238,13 +230,8 @@
238230
return clone;
239231
};
240232

241-
var findTemplate = function (source) {
242-
var node, candidate;
243-
if (stripByteOrderMark) {
244-
node = stripBOM(source);
245-
} else {
246-
node = source;
247-
}
233+
var findTemplate = function (node) {
234+
var candidate;
248235
if (!strictStandard) {
249236
return node;
250237
} else if (isTemplate(node)) {
@@ -281,15 +268,6 @@
281268
return obj === undefined ? "" : obj;
282269
};
283270

284-
var stripBOM = function(buf) {
285-
var str = buf.toString("utf-8");
286-
if(str.charCodeAt(0) === 0xFEFF) {
287-
return str.slice(1);
288-
} else {
289-
return str;
290-
}
291-
};
292-
293271
/* PRIVATE METHODS */
294272

295273
var clear = function (template, callback) {
@@ -666,9 +644,6 @@
666644
if ("showHeritage" in config) {
667645
strictStandard = !!config.showHeritage;
668646
}
669-
if ("stripByteOrderMark" in config) {
670-
stripByteOrderMark = !!config.stripByteOrderMark;
671-
}
672647
}
673648
return this;
674649
},
@@ -779,18 +754,6 @@
779754
return showHeritage;
780755
},
781756

782-
getSetStripByteOrderMark: function (boo) {
783-
/**
784-
* @param boo {Boolean} When true, strips Byte Order Mark from incoming HTML snippets.
785-
* @returns {Boolean} The current setting.
786-
*/
787-
if (arguments.length > 0) {
788-
stripByteOrderMark = !!boo;
789-
}
790-
791-
return showHeritage;
792-
},
793-
794757
getSetSource: function (obj) {
795758

796759
if (arguments.length > 0) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "microdata-template",
3-
"version": "2.3.0",
3+
"version": "2.2.2",
44
"description": "An implementation of HTML template by way of the microdata mechanism.",
55
"keywords": [
66
"javascript",

0 commit comments

Comments
 (0)