Fix lint and add license header
This commit is contained in:
@@ -1,9 +1,33 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2016-2025, jszhou
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
// From https://gist.github.com/jickoo/7b4122829240cc415c098aab89d6f49d
|
||||
|
||||
// Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/append()/append().md
|
||||
(function (arr) {
|
||||
arr.forEach(function (item) {
|
||||
if (item.hasOwnProperty('append')) {
|
||||
if (Object.prototype.hasOwnProperty.call(item, 'append')) {
|
||||
return;
|
||||
}
|
||||
Object.defineProperty(item, 'append', {
|
||||
@@ -11,11 +35,11 @@
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: function append() {
|
||||
var argArr = Array.prototype.slice.call(arguments),
|
||||
docFrag = document.createDocumentFragment();
|
||||
const argArr = Array.prototype.slice.call(arguments);
|
||||
const docFrag = document.createDocumentFragment();
|
||||
|
||||
argArr.forEach(function (argItem) {
|
||||
var isNode = argItem instanceof Node;
|
||||
const isNode = argItem instanceof Node;
|
||||
docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem)));
|
||||
});
|
||||
|
||||
@@ -28,7 +52,7 @@
|
||||
// Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/prepend()/prepend().md
|
||||
(function (arr) {
|
||||
arr.forEach(function (item) {
|
||||
if (item.hasOwnProperty('prepend')) {
|
||||
if (Object.prototype.hasOwnProperty.call(item, 'prepend')) {
|
||||
return;
|
||||
}
|
||||
Object.defineProperty(item, 'prepend', {
|
||||
@@ -36,11 +60,11 @@
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: function prepend() {
|
||||
var argArr = Array.prototype.slice.call(arguments),
|
||||
docFrag = document.createDocumentFragment();
|
||||
const argArr = Array.prototype.slice.call(arguments);
|
||||
const docFrag = document.createDocumentFragment();
|
||||
|
||||
argArr.forEach(function (argItem) {
|
||||
var isNode = argItem instanceof Node;
|
||||
const isNode = argItem instanceof Node;
|
||||
docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem)));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user