External Libraries: Update several polyfill libraries.
This updates the following polyfill libraries: - `formdata-polyfill` from `3.0.13` to `3.0.20`. - `objectFitPolyfill` from `2.3.4` to `2.3.5`. - `polyfill-library` from `3.42.0` to `3.104.0`. Props gziolo, desrosj. Fixes #52854. Built from https://develop.svn.wordpress.org/trunk@50615 git-svn-id: http://core.svn.wordpress.org/trunk@50228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
67d6f5f6c6
commit
7eee8521b0
|
@ -1,99 +0,0 @@
|
||||||
(function (global) {
|
|
||||||
function number(v) {
|
|
||||||
return v === undefined ? 0 : Number(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
function different(u, v) {
|
|
||||||
return u !== v && !(isNaN(u) && isNaN(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
function DOMRect(xArg, yArg, wArg, hArg) {
|
|
||||||
var x, y, width, height, left, right, top, bottom;
|
|
||||||
|
|
||||||
x = number(xArg);
|
|
||||||
y = number(yArg);
|
|
||||||
width = number(wArg);
|
|
||||||
height = number(hArg);
|
|
||||||
|
|
||||||
Object.defineProperties(this, {
|
|
||||||
x: {
|
|
||||||
get: function () { return x; },
|
|
||||||
set: function (newX) {
|
|
||||||
if (different(x, newX)) {
|
|
||||||
x = newX;
|
|
||||||
left = right = undefined;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
enumerable: true
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
get: function () { return y; },
|
|
||||||
set: function (newY) {
|
|
||||||
if (different(y, newY)) {
|
|
||||||
y = newY;
|
|
||||||
top = bottom = undefined;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
enumerable: true
|
|
||||||
},
|
|
||||||
width: {
|
|
||||||
get: function () { return width; },
|
|
||||||
set: function (newWidth) {
|
|
||||||
if (different(width, newWidth)) {
|
|
||||||
width = newWidth;
|
|
||||||
left = right = undefined;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
enumerable: true
|
|
||||||
},
|
|
||||||
height: {
|
|
||||||
get: function () { return height; },
|
|
||||||
set: function (newHeight) {
|
|
||||||
if (different(height, newHeight)) {
|
|
||||||
height = newHeight;
|
|
||||||
top = bottom = undefined;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
enumerable: true
|
|
||||||
},
|
|
||||||
left: {
|
|
||||||
get: function () {
|
|
||||||
if (left === undefined) {
|
|
||||||
left = x + Math.min(0, width);
|
|
||||||
}
|
|
||||||
return left;
|
|
||||||
},
|
|
||||||
enumerable: true
|
|
||||||
},
|
|
||||||
right: {
|
|
||||||
get: function () {
|
|
||||||
if (right === undefined) {
|
|
||||||
right = x + Math.max(0, width);
|
|
||||||
}
|
|
||||||
return right;
|
|
||||||
},
|
|
||||||
enumerable: true
|
|
||||||
},
|
|
||||||
top: {
|
|
||||||
get: function () {
|
|
||||||
if (top === undefined) {
|
|
||||||
top = y + Math.min(0, height);
|
|
||||||
}
|
|
||||||
return top;
|
|
||||||
},
|
|
||||||
enumerable: true
|
|
||||||
},
|
|
||||||
bottom: {
|
|
||||||
get: function () {
|
|
||||||
if (bottom === undefined) {
|
|
||||||
bottom = y + Math.max(0, height);
|
|
||||||
}
|
|
||||||
return bottom;
|
|
||||||
},
|
|
||||||
enumerable: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
global.DOMRect = DOMRect;
|
|
||||||
}(this));
|
|
|
@ -1 +0,0 @@
|
||||||
!function(e){function d(e){return void 0===e?0:Number(e)}function g(e,t){return!(e===t||isNaN(e)&&isNaN(t))}e.DOMRect=function(e,t,n,i){var u,r,o,c,f=d(e),a=d(t),m=d(n),b=d(i);Object.defineProperties(this,{x:{get:function(){return f},set:function(e){g(f,e)&&(f=e,u=r=void 0)},enumerable:!0},y:{get:function(){return a},set:function(e){g(a,e)&&(a=e,o=c=void 0)},enumerable:!0},width:{get:function(){return m},set:function(e){g(m,e)&&(m=e,u=r=void 0)},enumerable:!0},height:{get:function(){return b},set:function(e){g(b,e)&&(b=e,o=c=void 0)},enumerable:!0},left:{get:function(){return u=void 0===u?f+Math.min(0,m):u},enumerable:!0},right:{get:function(){return r=void 0===r?f+Math.max(0,m):r},enumerable:!0},top:{get:function(){return o=void 0===o?a+Math.min(0,b):o},enumerable:!0},bottom:{get:function(){return c=void 0===c?a+Math.max(0,b):c},enumerable:!0}})}}(this);
|
|
|
@ -1,7 +1,12 @@
|
||||||
if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
/* global FormData self Blob File */
|
||||||
const global = typeof window === 'object'
|
/* eslint-disable no-inner-declarations */
|
||||||
? window : typeof self === 'object'
|
|
||||||
? self : this
|
if (typeof Blob !== 'undefined' && (typeof FormData === 'undefined' || !FormData.prototype.keys)) {
|
||||||
|
const global = typeof globalThis === 'object'
|
||||||
|
? globalThis
|
||||||
|
: typeof window === 'object'
|
||||||
|
? window
|
||||||
|
: typeof self === 'object' ? self : this
|
||||||
|
|
||||||
// keep a reference to native implementation
|
// keep a reference to native implementation
|
||||||
const _FormData = global.FormData
|
const _FormData = global.FormData
|
||||||
|
@ -9,16 +14,15 @@ if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
||||||
// To be monkey patched
|
// To be monkey patched
|
||||||
const _send = global.XMLHttpRequest && global.XMLHttpRequest.prototype.send
|
const _send = global.XMLHttpRequest && global.XMLHttpRequest.prototype.send
|
||||||
const _fetch = global.Request && global.fetch
|
const _fetch = global.Request && global.fetch
|
||||||
|
const _sendBeacon = global.navigator && global.navigator.sendBeacon
|
||||||
|
// Might be a worker thread...
|
||||||
|
const _match = global.Element && global.Element.prototype
|
||||||
|
|
||||||
// Unable to patch Request constructor correctly
|
// Unable to patch Request/Response constructor correctly #109
|
||||||
// const _Request = global.Request
|
|
||||||
// only way is to use ES6 class extend
|
// only way is to use ES6 class extend
|
||||||
// https://github.com/babel/babel/issues/1966
|
// https://github.com/babel/babel/issues/1966
|
||||||
|
|
||||||
const stringTag = global.Symbol && Symbol.toStringTag
|
const stringTag = global.Symbol && Symbol.toStringTag
|
||||||
const map = new WeakMap
|
|
||||||
const wm = o => map.get(o)
|
|
||||||
const arrayFrom = Array.from || (obj => [].slice.call(obj))
|
|
||||||
|
|
||||||
// Add missing stringTags to blob and files
|
// Add missing stringTags to blob and files
|
||||||
if (stringTag) {
|
if (stringTag) {
|
||||||
|
@ -33,11 +37,11 @@ if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
||||||
|
|
||||||
// Fix so you can construct your own File
|
// Fix so you can construct your own File
|
||||||
try {
|
try {
|
||||||
new File([], '')
|
new File([], '') // eslint-disable-line
|
||||||
} catch (a) {
|
} catch (a) {
|
||||||
global.File = function(b, d, c) {
|
global.File = function File (b, d, c) {
|
||||||
const blob = new Blob(b, c)
|
const blob = new Blob(b, c)
|
||||||
const t = c && void 0 !== c.lastModified ? new Date(c.lastModified) : new Date
|
const t = c && void 0 !== c.lastModified ? new Date(c.lastModified) : new Date()
|
||||||
|
|
||||||
Object.defineProperties(blob, {
|
Object.defineProperties(blob, {
|
||||||
name: {
|
name: {
|
||||||
|
@ -50,7 +54,7 @@ if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
||||||
value: +t
|
value: +t
|
||||||
},
|
},
|
||||||
toString: {
|
toString: {
|
||||||
value() {
|
value () {
|
||||||
return '[object File]'
|
return '[object File]'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,41 +70,42 @@ if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeValue([value, filename]) {
|
function normalizeValue ([name, value, filename]) {
|
||||||
if (value instanceof Blob)
|
if (value instanceof Blob) {
|
||||||
// Should always returns a new File instance
|
// Should always returns a new File instance
|
||||||
// console.assert(fd.get(x) !== fd.get(x))
|
// console.assert(fd.get(x) !== fd.get(x))
|
||||||
value = new File([value], filename, {
|
value = new File([value], filename, {
|
||||||
type: value.type,
|
type: value.type,
|
||||||
lastModified: value.lastModified
|
lastModified: value.lastModified
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return value
|
return [name, value]
|
||||||
}
|
}
|
||||||
|
|
||||||
function stringify(name) {
|
function ensureArgs (args, expected) {
|
||||||
if (!arguments.length)
|
if (args.length < expected) {
|
||||||
throw new TypeError('1 argument required, but only 0 present.')
|
throw new TypeError(`${expected} argument required, but only ${args.length} present.`)
|
||||||
|
}
|
||||||
return [name + '']
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeArgs(name, value, filename) {
|
function normalizeArgs (name, value, filename) {
|
||||||
if (arguments.length < 2)
|
|
||||||
throw new TypeError(
|
|
||||||
`2 arguments required, but only ${arguments.length} present.`
|
|
||||||
)
|
|
||||||
|
|
||||||
return value instanceof Blob
|
return value instanceof Blob
|
||||||
// normalize name and filename if adding an attachment
|
// normalize name and filename if adding an attachment
|
||||||
? [name + '', value, filename !== undefined
|
? [String(name), value, filename !== undefined
|
||||||
? filename + '' // Cast filename to string if 3th arg isn't undefined
|
? filename + '' // Cast filename to string if 3th arg isn't undefined
|
||||||
: typeof value.name === 'string' // if name prop exist
|
: typeof value.name === 'string' // if name prop exist
|
||||||
? value.name // Use File.name
|
? value.name // Use File.name
|
||||||
: 'blob'] // otherwise fallback to Blob
|
: 'blob'] // otherwise fallback to Blob
|
||||||
|
|
||||||
// If no attachment, just cast the args to strings
|
// If no attachment, just cast the args to strings
|
||||||
: [name + '', value + '']
|
: [String(name), String(value)]
|
||||||
|
}
|
||||||
|
|
||||||
|
// normalize linefeeds for textareas
|
||||||
|
// https://html.spec.whatwg.org/multipage/form-elements.html#textarea-line-break-normalisation-transformation
|
||||||
|
function normalizeLinefeeds (value) {
|
||||||
|
return value.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
function each (arr, cb) {
|
function each (arr, cb) {
|
||||||
|
@ -113,25 +118,31 @@ if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
||||||
* @implements {Iterable}
|
* @implements {Iterable}
|
||||||
*/
|
*/
|
||||||
class FormDataPolyfill {
|
class FormDataPolyfill {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FormData class
|
* FormData class
|
||||||
*
|
*
|
||||||
* @param {HTMLElement=} form
|
* @param {HTMLElement=} form
|
||||||
*/
|
*/
|
||||||
constructor(form) {
|
constructor (form) {
|
||||||
map.set(this, Object.create(null))
|
this._data = []
|
||||||
|
|
||||||
if (!form)
|
|
||||||
return this
|
|
||||||
|
|
||||||
const self = this
|
const self = this
|
||||||
|
|
||||||
each(form.elements, elm => {
|
form && each(form.elements, elm => {
|
||||||
if (!elm.name || elm.disabled || elm.type === 'submit' || elm.type === 'button') return
|
if (
|
||||||
|
!elm.name ||
|
||||||
|
elm.disabled ||
|
||||||
|
elm.type === 'submit' ||
|
||||||
|
elm.type === 'button' ||
|
||||||
|
elm.matches('form fieldset[disabled] *')
|
||||||
|
) return
|
||||||
|
|
||||||
if (elm.type === 'file') {
|
if (elm.type === 'file') {
|
||||||
each(elm.files || [], file => {
|
const files = elm.files && elm.files.length
|
||||||
|
? elm.files
|
||||||
|
: [new File([], '', { type: 'application/octet-stream' })] // #78
|
||||||
|
|
||||||
|
each(files, file => {
|
||||||
self.append(elm.name, file)
|
self.append(elm.name, file)
|
||||||
})
|
})
|
||||||
} else if (elm.type === 'select-multiple' || elm.type === 'select-one') {
|
} else if (elm.type === 'select-multiple' || elm.type === 'select-one') {
|
||||||
|
@ -141,52 +152,52 @@ if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
||||||
} else if (elm.type === 'checkbox' || elm.type === 'radio') {
|
} else if (elm.type === 'checkbox' || elm.type === 'radio') {
|
||||||
if (elm.checked) self.append(elm.name, elm.value)
|
if (elm.checked) self.append(elm.name, elm.value)
|
||||||
} else {
|
} else {
|
||||||
self.append(elm.name, elm.value)
|
const value = elm.type === 'textarea' ? normalizeLinefeeds(elm.value) : elm.value
|
||||||
|
self.append(elm.name, value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a field
|
* Append a field
|
||||||
*
|
*
|
||||||
* @param {String} name field name
|
* @param {string} name field name
|
||||||
* @param {String|Blob|File} value string / blob / file
|
* @param {string|Blob|File} value string / blob / file
|
||||||
* @param {String=} filename filename to use with blob
|
* @param {string=} filename filename to use with blob
|
||||||
* @return {Undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
append(name, value, filename) {
|
append (name, value, filename) {
|
||||||
const map = wm(this)
|
ensureArgs(arguments, 2)
|
||||||
|
this._data.push(normalizeArgs(name, value, filename))
|
||||||
if (!map[name])
|
|
||||||
map[name] = []
|
|
||||||
|
|
||||||
map[name].push([value, filename])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all fields values given name
|
* Delete all fields values given name
|
||||||
*
|
*
|
||||||
* @param {String} name Field name
|
* @param {string} name Field name
|
||||||
* @return {Undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
delete(name) {
|
delete (name) {
|
||||||
delete wm(this)[name]
|
ensureArgs(arguments, 1)
|
||||||
}
|
const result = []
|
||||||
|
name = String(name)
|
||||||
|
|
||||||
|
each(this._data, entry => {
|
||||||
|
entry[0] !== name && result.push(entry)
|
||||||
|
})
|
||||||
|
|
||||||
|
this._data = result
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate over all fields as [name, value]
|
* Iterate over all fields as [name, value]
|
||||||
*
|
*
|
||||||
* @return {Iterator}
|
* @return {Iterator}
|
||||||
*/
|
*/
|
||||||
*entries() {
|
* entries () {
|
||||||
const map = wm(this)
|
for (var i = 0; i < this._data.length; i++) {
|
||||||
|
yield normalizeValue(this._data[i])
|
||||||
for (let name in map)
|
}
|
||||||
for (let value of map[name])
|
|
||||||
yield [name, normalizeValue(value)]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,115 +205,150 @@ if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
||||||
*
|
*
|
||||||
* @param {Function} callback Executed for each item with parameters (value, name, thisArg)
|
* @param {Function} callback Executed for each item with parameters (value, name, thisArg)
|
||||||
* @param {Object=} thisArg `this` context for callback function
|
* @param {Object=} thisArg `this` context for callback function
|
||||||
* @return {Undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
forEach(callback, thisArg) {
|
forEach (callback, thisArg) {
|
||||||
for (let [name, value] of this)
|
ensureArgs(arguments, 1)
|
||||||
|
for (const [name, value] of this) {
|
||||||
callback.call(thisArg, value, name, this)
|
callback.call(thisArg, value, name, this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return first field value given name
|
* Return first field value given name
|
||||||
* or null if non existen
|
* or null if non existen
|
||||||
*
|
*
|
||||||
* @param {String} name Field name
|
* @param {string} name Field name
|
||||||
* @return {String|File|null} value Fields value
|
* @return {string|File|null} value Fields value
|
||||||
*/
|
*/
|
||||||
get(name) {
|
get (name) {
|
||||||
const map = wm(this)
|
ensureArgs(arguments, 1)
|
||||||
return map[name] ? normalizeValue(map[name][0]) : null
|
const entries = this._data
|
||||||
|
name = String(name)
|
||||||
|
for (let i = 0; i < entries.length; i++) {
|
||||||
|
if (entries[i][0] === name) {
|
||||||
|
return normalizeValue(entries[i])[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all fields values given name
|
* Return all fields values given name
|
||||||
*
|
*
|
||||||
* @param {String} name Fields name
|
* @param {string} name Fields name
|
||||||
* @return {Array} [{String|File}]
|
* @return {Array} [{String|File}]
|
||||||
*/
|
*/
|
||||||
getAll(name) {
|
getAll (name) {
|
||||||
return (wm(this)[name] || []).map(normalizeValue)
|
ensureArgs(arguments, 1)
|
||||||
}
|
const result = []
|
||||||
|
name = String(name)
|
||||||
|
each(this._data, data => {
|
||||||
|
data[0] === name && result.push(normalizeValue(data)[1])
|
||||||
|
})
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for field name existence
|
* Check for field name existence
|
||||||
*
|
*
|
||||||
* @param {String} name Field name
|
* @param {string} name Field name
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
has(name) {
|
has (name) {
|
||||||
return name in wm(this)
|
ensureArgs(arguments, 1)
|
||||||
|
name = String(name)
|
||||||
|
for (let i = 0; i < this._data.length; i++) {
|
||||||
|
if (this._data[i][0] === name) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate over all fields name
|
* Iterate over all fields name
|
||||||
*
|
*
|
||||||
* @return {Iterator}
|
* @return {Iterator}
|
||||||
*/
|
*/
|
||||||
*keys() {
|
* keys () {
|
||||||
for (let [name] of this)
|
for (const [name] of this) {
|
||||||
yield name
|
yield name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrite all values given name
|
* Overwrite all values given name
|
||||||
*
|
*
|
||||||
* @param {String} name Filed name
|
* @param {string} name Filed name
|
||||||
* @param {String} value Field value
|
* @param {string} value Field value
|
||||||
* @param {String=} filename Filename (optional)
|
* @param {string=} filename Filename (optional)
|
||||||
* @return {Undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
set(name, value, filename) {
|
set (name, value, filename) {
|
||||||
wm(this)[name] = [[value, filename]]
|
ensureArgs(arguments, 2)
|
||||||
}
|
name = String(name)
|
||||||
|
const result = []
|
||||||
|
const args = normalizeArgs(name, value, filename)
|
||||||
|
let replace = true
|
||||||
|
|
||||||
|
// - replace the first occurrence with same name
|
||||||
|
// - discards the remaning with same name
|
||||||
|
// - while keeping the same order items where added
|
||||||
|
each(this._data, data => {
|
||||||
|
data[0] === name
|
||||||
|
? replace && (replace = !result.push(args))
|
||||||
|
: result.push(data)
|
||||||
|
})
|
||||||
|
|
||||||
|
replace && result.push(args)
|
||||||
|
|
||||||
|
this._data = result
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate over all fields
|
* Iterate over all fields
|
||||||
*
|
*
|
||||||
* @return {Iterator}
|
* @return {Iterator}
|
||||||
*/
|
*/
|
||||||
*values() {
|
* values () {
|
||||||
for (let [name, value] of this)
|
for (const [, value] of this) {
|
||||||
yield value
|
yield value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a native (perhaps degraded) FormData with only a `append` method
|
* Return a native (perhaps degraded) FormData with only a `append` method
|
||||||
* Can throw if it's not supported
|
* Can throw if it's not supported
|
||||||
*
|
*
|
||||||
* @return {FormData}
|
* @return {FormData}
|
||||||
*/
|
*/
|
||||||
['_asNative']() {
|
['_asNative'] () {
|
||||||
const fd = new _FormData
|
const fd = new _FormData()
|
||||||
|
|
||||||
for (let [name, value] of this)
|
for (const [name, value] of this) {
|
||||||
fd.append(name, value)
|
fd.append(name, value)
|
||||||
|
}
|
||||||
|
|
||||||
return fd
|
return fd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [_blob description]
|
* [_blob description]
|
||||||
*
|
*
|
||||||
* @return {Blob} [description]
|
* @return {Blob} [description]
|
||||||
*/
|
*/
|
||||||
['_blob']() {
|
['_blob'] () {
|
||||||
const boundary = '----formdata-polyfill-' + Math.random()
|
const boundary = '----formdata-polyfill-' + Math.random()
|
||||||
const chunks = []
|
const chunks = []
|
||||||
|
|
||||||
for (let [name, value] of this) {
|
for (const [name, value] of this) {
|
||||||
chunks.push(`--${boundary}\r\n`)
|
chunks.push(`--${boundary}\r\n`)
|
||||||
|
|
||||||
if (value instanceof Blob) {
|
if (value instanceof Blob) {
|
||||||
chunks.push(
|
chunks.push(
|
||||||
`Content-Disposition: form-data; name="${name}"; filename="${value.name}"\r\n`,
|
`Content-Disposition: form-data; name="${name}"; filename="${value.name}"\r\n` +
|
||||||
`Content-Type: ${value.type || 'application/octet-stream'}\r\n\r\n`,
|
`Content-Type: ${value.type || 'application/octet-stream'}\r\n\r\n`,
|
||||||
value,
|
value,
|
||||||
'\r\n'
|
'\r\n'
|
||||||
|
@ -316,67 +362,68 @@ if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
||||||
|
|
||||||
chunks.push(`--${boundary}--`)
|
chunks.push(`--${boundary}--`)
|
||||||
|
|
||||||
return new Blob(chunks, {type: 'multipart/form-data; boundary=' + boundary})
|
return new Blob(chunks, {
|
||||||
|
type: 'multipart/form-data; boundary=' + boundary
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class itself is iterable
|
* The class itself is iterable
|
||||||
* alias for formdata.entries()
|
* alias for formdata.entries()
|
||||||
*
|
*
|
||||||
* @return {Iterator}
|
* @return {Iterator}
|
||||||
*/
|
*/
|
||||||
[Symbol.iterator]() {
|
[Symbol.iterator] () {
|
||||||
return this.entries()
|
return this.entries()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the default string description.
|
* Create the default string description.
|
||||||
*
|
*
|
||||||
* @return {String} [object FormData]
|
* @return {string} [object FormData]
|
||||||
*/
|
*/
|
||||||
toString() {
|
toString () {
|
||||||
return '[object FormData]'
|
return '[object FormData]'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_match && !_match.matches) {
|
||||||
|
_match.matches =
|
||||||
|
_match.matchesSelector ||
|
||||||
|
_match.mozMatchesSelector ||
|
||||||
|
_match.msMatchesSelector ||
|
||||||
|
_match.oMatchesSelector ||
|
||||||
|
_match.webkitMatchesSelector ||
|
||||||
|
function (s) {
|
||||||
|
var matches = (this.document || this.ownerDocument).querySelectorAll(s)
|
||||||
|
var i = matches.length
|
||||||
|
while (--i >= 0 && matches.item(i) !== this) {}
|
||||||
|
return i > -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (stringTag) {
|
if (stringTag) {
|
||||||
/**
|
/**
|
||||||
* Create the default string description.
|
* Create the default string description.
|
||||||
* It is accessed internally by the Object.prototype.toString().
|
* It is accessed internally by the Object.prototype.toString().
|
||||||
*
|
|
||||||
* @return {String} FormData
|
|
||||||
*/
|
*/
|
||||||
FormDataPolyfill.prototype[stringTag] = 'FormData'
|
FormDataPolyfill.prototype[stringTag] = 'FormData'
|
||||||
}
|
}
|
||||||
|
|
||||||
const decorations = [
|
|
||||||
['append', normalizeArgs],
|
|
||||||
['delete', stringify],
|
|
||||||
['get', stringify],
|
|
||||||
['getAll', stringify],
|
|
||||||
['has', stringify],
|
|
||||||
['set', normalizeArgs]
|
|
||||||
]
|
|
||||||
|
|
||||||
decorations.forEach(arr => {
|
|
||||||
const orig = FormDataPolyfill.prototype[arr[0]]
|
|
||||||
FormDataPolyfill.prototype[arr[0]] = function() {
|
|
||||||
return orig.apply(this, arr[1].apply(this, arrayFrom(arguments)))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Patch xhr's send method to call _blob transparently
|
// Patch xhr's send method to call _blob transparently
|
||||||
if (_send) {
|
if (_send) {
|
||||||
XMLHttpRequest.prototype.send = function(data) {
|
const setRequestHeader = global.XMLHttpRequest.prototype.setRequestHeader
|
||||||
// I would check if Content-Type isn't already set
|
|
||||||
// But xhr lacks getRequestHeaders functionallity
|
global.XMLHttpRequest.prototype.setRequestHeader = function (name, value) {
|
||||||
// https://github.com/jimmywarting/FormData/issues/44
|
setRequestHeader.call(this, name, value)
|
||||||
|
if (name.toLowerCase() === 'content-type') this._hasContentType = true
|
||||||
|
}
|
||||||
|
|
||||||
|
global.XMLHttpRequest.prototype.send = function (data) {
|
||||||
|
// need to patch send b/c old IE don't send blob's type (#44)
|
||||||
if (data instanceof FormDataPolyfill) {
|
if (data instanceof FormDataPolyfill) {
|
||||||
const blob = data['_blob']()
|
const blob = data['_blob']()
|
||||||
this.setRequestHeader('Content-Type', blob.type)
|
if (!this._hasContentType) this.setRequestHeader('Content-Type', blob.type)
|
||||||
_send.call(this, blob)
|
_send.call(this, blob)
|
||||||
} else {
|
} else {
|
||||||
_send.call(this, data)
|
_send.call(this, data)
|
||||||
|
@ -386,14 +433,22 @@ if (typeof FormData === 'undefined' || !FormData.prototype.keys) {
|
||||||
|
|
||||||
// Patch fetch's function to call _blob transparently
|
// Patch fetch's function to call _blob transparently
|
||||||
if (_fetch) {
|
if (_fetch) {
|
||||||
const _fetch = global.fetch
|
global.fetch = function (input, init) {
|
||||||
|
|
||||||
global.fetch = function(input, init) {
|
|
||||||
if (init && init.body && init.body instanceof FormDataPolyfill) {
|
if (init && init.body && init.body instanceof FormDataPolyfill) {
|
||||||
init.body = init.body['_blob']()
|
init.body = init.body['_blob']()
|
||||||
}
|
}
|
||||||
|
|
||||||
return _fetch(input, init)
|
return _fetch.call(this, input, init)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch navigator.sendBeacon to use native FormData
|
||||||
|
if (_sendBeacon) {
|
||||||
|
global.navigator.sendBeacon = function (url, data) {
|
||||||
|
if (data instanceof FormDataPolyfill) {
|
||||||
|
data = data['_asNative']()
|
||||||
|
}
|
||||||
|
return _sendBeacon.call(this, url, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
;(function(){var k;function l(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var m="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,d){a!=Array.prototype&&a!=Object.prototype&&(a[b]=d.value)},n="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function p(){p=function(){};n.Symbol||(n.Symbol=r)}var r=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}();
|
;(function(){var h;function l(a){var c=0;return function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}}}var m="function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){if(a==Array.prototype||a==Object.prototype)return a;a[c]=b.value;return a};
|
||||||
function u(){p();var a=n.Symbol.iterator;a||(a=n.Symbol.iterator=n.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&m(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return v(l(this))}});u=function(){}}function v(a){u();a={next:a};a[n.Symbol.iterator]=function(){return this};return a}function x(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:l(a)}}var y;
|
function n(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var c=0;c<a.length;++c){var b=a[c];if(b&&b.Math==Math)return b}throw Error("Cannot find global object");}var p=n(this);function r(a,c){if(c){for(var b=p,d=a.split("."),e=0;e<d.length-1;e++){var f=d[e];f in b||(b[f]={});b=b[f]}d=d[d.length-1];e=b[d];f=c(e);f!=e&&null!=f&&m(b,d,{configurable:!0,writable:!0,value:f})}}
|
||||||
if("function"==typeof Object.setPrototypeOf)y=Object.setPrototypeOf;else{var z;a:{var A={o:!0},B={};try{B.__proto__=A;z=B.o;break a}catch(a){}z=!1}y=z?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var C=y;function D(){this.g=!1;this.c=null;this.m=void 0;this.b=1;this.l=this.s=0;this.f=null}function E(a){if(a.g)throw new TypeError("Generator is already running");a.g=!0}D.prototype.h=function(a){this.m=a};
|
r("Symbol",function(a){function c(e){if(this instanceof c)throw new TypeError("Symbol is not a constructor");return new b("jscomp_symbol_"+(e||"")+"_"+d++,e)}function b(e,f){this.o=e;m(this,"description",{configurable:!0,writable:!0,value:f})}if(a)return a;b.prototype.toString=function(){return this.o};var d=0;return c});
|
||||||
D.prototype.i=function(a){this.f={u:a,v:!0};this.b=this.s||this.l};D.prototype["return"]=function(a){this.f={"return":a};this.b=this.l};function F(a,b,d){a.b=d;return{value:b}}function G(a){this.w=a;this.j=[];for(var b in a)this.j.push(b);this.j.reverse()}function H(a){this.a=new D;this.A=a}H.prototype.h=function(a){E(this.a);if(this.a.c)return I(this,this.a.c.next,a,this.a.h);this.a.h(a);return J(this)};
|
r("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var c="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),b=0;b<c.length;b++){var d=p[c[b]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&m(d.prototype,a,{configurable:!0,writable:!0,value:function(){return u(l(this))}})}return a});function u(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}
|
||||||
function K(a,b){E(a.a);var d=a.a.c;if(d)return I(a,"return"in d?d["return"]:function(a){return{value:a,done:!0}},b,a.a["return"]);a.a["return"](b);return J(a)}H.prototype.i=function(a){E(this.a);if(this.a.c)return I(this,this.a.c["throw"],a,this.a.h);this.a.i(a);return J(this)};
|
function v(a){var c="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return c?c.call(a):{next:l(a)}}var w;if("function"==typeof Object.setPrototypeOf)w=Object.setPrototypeOf;else{var y;a:{var z={u:!0},A={};try{A.__proto__=z;y=A.u;break a}catch(a){}y=!1}w=y?function(a,c){a.__proto__=c;if(a.__proto__!==c)throw new TypeError(a+" is not extensible");return a}:null}var B=w;function C(){this.h=!1;this.f=null;this.m=void 0;this.b=1;this.l=this.v=0;this.g=null}
|
||||||
function I(a,b,d,c){try{var e=b.call(a.a.c,d);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.a.g=!1,e;var f=e.value}catch(g){return a.a.c=null,a.a.i(g),J(a)}a.a.c=null;c.call(a.a,f);return J(a)}function J(a){for(;a.a.b;)try{var b=a.A(a.a);if(b)return a.a.g=!1,{value:b.value,done:!1}}catch(d){a.a.m=void 0,a.a.i(d)}a.a.g=!1;if(a.a.f){b=a.a.f;a.a.f=null;if(b.v)throw b.u;return{value:b["return"],done:!0}}return{value:void 0,done:!0}}
|
function D(a){if(a.h)throw new TypeError("Generator is already running");a.h=!0}C.prototype.i=function(a){this.m=a};C.prototype.j=function(a){this.g={w:a,A:!0};this.b=this.v||this.l};C.prototype["return"]=function(a){this.g={"return":a};this.b=this.l};function E(a,c){a.b=3;return{value:c}}function F(a){this.a=new C;this.B=a}F.prototype.i=function(a){D(this.a);if(this.a.f)return G(this,this.a.f.next,a,this.a.i);this.a.i(a);return H(this)};
|
||||||
function L(a){this.next=function(b){return a.h(b)};this["throw"]=function(b){return a.i(b)};this["return"]=function(b){return K(a,b)};u();this[Symbol.iterator]=function(){return this}}function M(a,b){var d=new L(new H(b));C&&C(d,a.prototype);return d}
|
function I(a,c){D(a.a);var b=a.a.f;if(b)return G(a,"return"in b?b["return"]:function(d){return{value:d,done:!0}},c,a.a["return"]);a.a["return"](c);return H(a)}F.prototype.j=function(a){D(this.a);if(this.a.f)return G(this,this.a.f["throw"],a,this.a.i);this.a.j(a);return H(this)};
|
||||||
if("undefined"===typeof FormData||!FormData.prototype.keys){var N=function(a,b){for(var d=0;d<a.length;d++)b(a[d])},O=function(a,b,d){if(2>arguments.length)throw new TypeError("2 arguments required, but only "+arguments.length+" present.");return b instanceof Blob?[a+"",b,void 0!==d?d+"":"string"===typeof b.name?b.name:"blob"]:[a+"",b+""]},P=function(a){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");return[a+""]},Q=function(a){var b=x(a);a=b.next().value;b=b.next().value;
|
function G(a,c,b,d){try{var e=c.call(a.a.f,b);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.a.h=!1,e;var f=e.value}catch(g){return a.a.f=null,a.a.j(g),H(a)}a.a.f=null;d.call(a.a,f);return H(a)}function H(a){for(;a.a.b;)try{var c=a.B(a.a);if(c)return a.a.h=!1,{value:c.value,done:!1}}catch(b){a.a.m=void 0,a.a.j(b)}a.a.h=!1;if(a.a.g){c=a.a.g;a.a.g=null;if(c.A)throw c.w;return{value:c["return"],done:!0}}return{value:void 0,done:!0}}
|
||||||
a instanceof Blob&&(a=new File([a],b,{type:a.type,lastModified:a.lastModified}));return a},R="object"===typeof window?window:"object"===typeof self?self:this,S=R.FormData,T=R.XMLHttpRequest&&R.XMLHttpRequest.prototype.send,U=R.Request&&R.fetch;p();var V=R.Symbol&&Symbol.toStringTag,W=new WeakMap,X=Array.from||function(a){return[].slice.call(a)};V&&(Blob.prototype[V]||(Blob.prototype[V]="Blob"),"File"in R&&!File.prototype[V]&&(File.prototype[V]="File"));try{new File([],"")}catch(a){R.File=function(b,
|
function J(a){this.next=function(c){return a.i(c)};this["throw"]=function(c){return a.j(c)};this["return"]=function(c){return I(a,c)};this[Symbol.iterator]=function(){return this}}function K(a,c){var b=new J(new F(c));B&&B(b,a.prototype);return b}
|
||||||
d,c){b=new Blob(b,c);c=c&&void 0!==c.lastModified?new Date(c.lastModified):new Date;Object.defineProperties(b,{name:{value:d},lastModifiedDate:{value:c},lastModified:{value:+c},toString:{value:function(){return"[object File]"}}});V&&Object.defineProperty(b,V,{value:"File"});return b}}p();u();var Y=function(a){W.set(this,Object.create(null));if(!a)return this;var b=this;N(a.elements,function(a){a.name&&!a.disabled&&"submit"!==a.type&&"button"!==a.type&&("file"===a.type?N(a.files||[],function(c){b.append(a.name,
|
if("undefined"!==typeof Blob&&("undefined"===typeof FormData||!FormData.prototype.keys)){var L=function(a,c){for(var b=0;b<a.length;b++)c(a[b])},M=function(a,c,b){return c instanceof Blob?[String(a),c,void 0!==b?b+"":"string"===typeof c.name?c.name:"blob"]:[String(a),String(c)]},N=function(a,c){if(a.length<c)throw new TypeError(c+" argument required, but only "+a.length+" present.");},O=function(a){var c=v(a);a=c.next().value;var b=c.next().value;c=c.next().value;b instanceof Blob&&(b=new File([b],
|
||||||
c)}):"select-multiple"===a.type||"select-one"===a.type?N(a.options,function(c){!c.disabled&&c.selected&&b.append(a.name,c.value)}):"checkbox"===a.type||"radio"===a.type?a.checked&&b.append(a.name,a.value):b.append(a.name,a.value))})};k=Y.prototype;k.append=function(a,b,d){var c=W.get(this);c[a]||(c[a]=[]);c[a].push([b,d])};k["delete"]=function(a){delete W.get(this)[a]};k.entries=function b(){var d=this,c,e,f,g,h,q;return M(b,function(b){switch(b.b){case 1:c=W.get(d),f=new G(c);case 2:var t;a:{for(t=
|
c,{type:b.type,lastModified:b.lastModified}));return[a,b]},P="object"===typeof globalThis?globalThis:"object"===typeof window?window:"object"===typeof self?self:this,Q=P.FormData,R=P.XMLHttpRequest&&P.XMLHttpRequest.prototype.send,S=P.Request&&P.fetch,T=P.navigator&&P.navigator.sendBeacon,U=P.Element&&P.Element.prototype,V=P.Symbol&&Symbol.toStringTag;V&&(Blob.prototype[V]||(Blob.prototype[V]="Blob"),"File"in P&&!File.prototype[V]&&(File.prototype[V]="File"));try{new File([],"")}catch(a){P.File=function(c,
|
||||||
f;0<t.j.length;){var w=t.j.pop();if(w in t.w){t=w;break a}}t=null}if(null==(e=t)){b.b=0;break}g=x(c[e]);h=g.next();case 5:if(h.done){b.b=2;break}q=h.value;return F(b,[e,Q(q)],6);case 6:h=g.next(),b.b=5}})};k.forEach=function(b,d){for(var c=x(this),e=c.next();!e.done;e=c.next()){var f=x(e.value);e=f.next().value;f=f.next().value;b.call(d,f,e,this)}};k.get=function(b){var d=W.get(this);return d[b]?Q(d[b][0]):null};k.getAll=function(b){return(W.get(this)[b]||[]).map(Q)};k.has=function(b){return b in
|
b,d){c=new Blob(c,d);d=d&&void 0!==d.lastModified?new Date(d.lastModified):new Date;Object.defineProperties(c,{name:{value:b},lastModifiedDate:{value:d},lastModified:{value:+d},toString:{value:function(){return"[object File]"}}});V&&Object.defineProperty(c,V,{value:"File"});return c}}var W=function(a){this.c=[];var c=this;a&&L(a.elements,function(b){if(b.name&&!b.disabled&&"submit"!==b.type&&"button"!==b.type&&!b.matches("form fieldset[disabled] *"))if("file"===b.type){var d=b.files&&b.files.length?
|
||||||
W.get(this)};k.keys=function d(){var c=this,e,f,g,h,q;return M(d,function(d){1==d.b&&(e=x(c),f=e.next());if(3!=d.b){if(f.done){d.b=0;return}g=f.value;h=x(g);q=h.next().value;return F(d,q,3)}f=e.next();d.b=2})};k.set=function(d,c,e){W.get(this)[d]=[[c,e]]};k.values=function c(){var e=this,f,g,h,q,w;return M(c,function(c){1==c.b&&(f=x(e),g=f.next());if(3!=c.b){if(g.done){c.b=0;return}h=g.value;q=x(h);q.next();w=q.next().value;return F(c,w,3)}g=f.next();c.b=2})};Y.prototype._asNative=function(){for(var c=
|
b.files:[new File([],"",{type:"application/octet-stream"})];L(d,function(e){c.append(b.name,e)})}else"select-multiple"===b.type||"select-one"===b.type?L(b.options,function(e){!e.disabled&&e.selected&&c.append(b.name,e.value)}):"checkbox"===b.type||"radio"===b.type?b.checked&&c.append(b.name,b.value):(d="textarea"===b.type?b.value.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"):b.value,c.append(b.name,d))})};h=W.prototype;h.append=function(a,c,b){N(arguments,2);this.c.push(M(a,c,b))};h["delete"]=function(a){N(arguments,
|
||||||
new S,e=x(this),f=e.next();!f.done;f=e.next()){var g=x(f.value);f=g.next().value;g=g.next().value;c.append(f,g)}return c};Y.prototype._blob=function(){for(var c="----formdata-polyfill-"+Math.random(),e=[],f=x(this),g=f.next();!g.done;g=f.next()){var h=x(g.value);g=h.next().value;h=h.next().value;e.push("--"+c+"\r\n");h instanceof Blob?e.push('Content-Disposition: form-data; name="'+g+'"; filename="'+h.name+'"\r\n',"Content-Type: "+(h.type||"application/octet-stream")+"\r\n\r\n",h,"\r\n"):e.push('Content-Disposition: form-data; name="'+
|
1);var c=[];a=String(a);L(this.c,function(b){b[0]!==a&&c.push(b)});this.c=c};h.entries=function c(){var b,d=this;return K(c,function(e){1==e.b&&(b=0);if(3!=e.b)return b<d.c.length?e=E(e,O(d.c[b])):(e.b=0,e=void 0),e;b++;e.b=2})};h.forEach=function(c,b){N(arguments,1);for(var d=v(this),e=d.next();!e.done;e=d.next()){var f=v(e.value);e=f.next().value;f=f.next().value;c.call(b,f,e,this)}};h.get=function(c){N(arguments,1);var b=this.c;c=String(c);for(var d=0;d<b.length;d++)if(b[d][0]===c)return O(b[d])[1];
|
||||||
g+'"\r\n\r\n'+h+"\r\n")}e.push("--"+c+"--");return new Blob(e,{type:"multipart/form-data; boundary="+c})};Y.prototype[Symbol.iterator]=function(){return this.entries()};Y.prototype.toString=function(){return"[object FormData]"};V&&(Y.prototype[V]="FormData");[["append",O],["delete",P],["get",P],["getAll",P],["has",P],["set",O]].forEach(function(c){var e=Y.prototype[c[0]];Y.prototype[c[0]]=function(){return e.apply(this,c[1].apply(this,X(arguments)))}});T&&(XMLHttpRequest.prototype.send=function(c){c instanceof
|
return null};h.getAll=function(c){N(arguments,1);var b=[];c=String(c);L(this.c,function(d){d[0]===c&&b.push(O(d)[1])});return b};h.has=function(c){N(arguments,1);c=String(c);for(var b=0;b<this.c.length;b++)if(this.c[b][0]===c)return!0;return!1};h.keys=function b(){var d=this,e,f,g,k,q;return K(b,function(t){1==t.b&&(e=v(d),f=e.next());if(3!=t.b){if(f.done){t.b=0;return}g=f.value;k=v(g);q=k.next().value;return E(t,q)}f=e.next();t.b=2})};h.set=function(b,d,e){N(arguments,2);b=String(b);var f=[],g=M(b,
|
||||||
Y?(c=c._blob(),this.setRequestHeader("Content-Type",c.type),T.call(this,c)):T.call(this,c)});if(U){var Z=R.fetch;R.fetch=function(c,e){e&&e.body&&e.body instanceof Y&&(e.body=e.body._blob());return Z(c,e)}}R.FormData=Y};
|
d,e),k=!0;L(this.c,function(q){q[0]===b?k&&(k=!f.push(g)):f.push(q)});k&&f.push(g);this.c=f};h.values=function d(){var e=this,f,g,k,q,t;return K(d,function(x){1==x.b&&(f=v(e),g=f.next());if(3!=x.b){if(g.done){x.b=0;return}k=g.value;q=v(k);q.next();t=q.next().value;return E(x,t)}g=f.next();x.b=2})};W.prototype._asNative=function(){for(var d=new Q,e=v(this),f=e.next();!f.done;f=e.next()){var g=v(f.value);f=g.next().value;g=g.next().value;d.append(f,g)}return d};W.prototype._blob=function(){for(var d=
|
||||||
|
"----formdata-polyfill-"+Math.random(),e=[],f=v(this),g=f.next();!g.done;g=f.next()){var k=v(g.value);g=k.next().value;k=k.next().value;e.push("--"+d+"\r\n");k instanceof Blob?e.push('Content-Disposition: form-data; name="'+g+'"; filename="'+k.name+'"\r\nContent-Type: '+((k.type||"application/octet-stream")+"\r\n\r\n"),k,"\r\n"):e.push('Content-Disposition: form-data; name="'+g+'"\r\n\r\n'+k+"\r\n")}e.push("--"+d+"--");return new Blob(e,{type:"multipart/form-data; boundary="+d})};W.prototype[Symbol.iterator]=
|
||||||
|
function(){return this.entries()};W.prototype.toString=function(){return"[object FormData]"};U&&!U.matches&&(U.matches=U.matchesSelector||U.mozMatchesSelector||U.msMatchesSelector||U.oMatchesSelector||U.webkitMatchesSelector||function(d){d=(this.document||this.ownerDocument).querySelectorAll(d);for(var e=d.length;0<=--e&&d.item(e)!==this;);return-1<e});V&&(W.prototype[V]="FormData");if(R){var X=P.XMLHttpRequest.prototype.setRequestHeader;P.XMLHttpRequest.prototype.setRequestHeader=function(d,e){X.call(this,
|
||||||
|
d,e);"content-type"===d.toLowerCase()&&(this.s=!0)};P.XMLHttpRequest.prototype.send=function(d){d instanceof W?(d=d._blob(),this.s||this.setRequestHeader("Content-Type",d.type),R.call(this,d)):R.call(this,d)}}S&&(P.fetch=function(d,e){e&&e.body&&e.body instanceof W&&(e.body=e.body._blob());return S.call(this,d,e)});T&&(P.navigator.sendBeacon=function(d,e){e instanceof W&&(e=e._asNative());return T.call(this,d,e)});P.FormData=W};
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
(function() {
|
|
||||||
|
|
||||||
function contains(node) {
|
|
||||||
if (!(0 in arguments)) {
|
|
||||||
throw new TypeError('1 argument is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (this === node) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} while (node = node && node.parentNode);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// IE
|
|
||||||
if ('HTMLElement' in this && 'contains' in HTMLElement.prototype) {
|
|
||||||
try {
|
|
||||||
delete HTMLElement.prototype.contains;
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('Node' in this) {
|
|
||||||
Node.prototype.contains = contains;
|
|
||||||
} else {
|
|
||||||
document.contains = Element.prototype.contains = contains;
|
|
||||||
}
|
|
||||||
|
|
||||||
}());
|
|
|
@ -1 +0,0 @@
|
||||||
!function(){function t(t){if(!(0 in arguments))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1}if("HTMLElement"in this&&"contains"in HTMLElement.prototype)try{delete HTMLElement.prototype.contains}catch(t){}"Node"in this?Node.prototype.contains=t:document.contains=Element.prototype.contains=t}();
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*----------------------------------------
|
/*----------------------------------------
|
||||||
* objectFitPolyfill 2.3.4
|
* objectFitPolyfill 2.3.5
|
||||||
*
|
*
|
||||||
* Made by Constance Chen
|
* Made by Constance Chen
|
||||||
* Released under the ISC license
|
* Released under the ISC license
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
*
|
*
|
||||||
* @param {string} axis - either "x" or "y"
|
* @param {string} axis - either "x" or "y"
|
||||||
* @param {node} $media - img or video element
|
* @param {node} $media - img or video element
|
||||||
* @param {string} objectPosition - e.g. "50% 50%", "top bottom"
|
* @param {string} objectPosition - e.g. "50% 50%", "top left"
|
||||||
*/
|
*/
|
||||||
var setPosition = function(axis, $media, objectPosition) {
|
var setPosition = function(axis, $media, objectPosition) {
|
||||||
var position, other, start, end, side;
|
var position, other, start, end, side;
|
||||||
|
@ -109,6 +109,7 @@
|
||||||
objectPosition[1] = objectPosition[0];
|
objectPosition[1] = objectPosition[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* istanbul ignore else */
|
||||||
if (axis === 'x') {
|
if (axis === 'x') {
|
||||||
position = objectPosition[0];
|
position = objectPosition[0];
|
||||||
other = objectPosition[1];
|
other = objectPosition[1];
|
||||||
|
@ -143,7 +144,7 @@
|
||||||
|
|
||||||
// Percentage values (e.g., 30% 10%)
|
// Percentage values (e.g., 30% 10%)
|
||||||
if (position.indexOf('%') >= 0) {
|
if (position.indexOf('%') >= 0) {
|
||||||
position = parseInt(position);
|
position = parseInt(position, 10);
|
||||||
|
|
||||||
if (position < 50) {
|
if (position < 50) {
|
||||||
$media.style[start] = position + '%';
|
$media.style[start] = position + '%';
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
!function(){"use strict";if("undefined"!=typeof window){var t=window.navigator.userAgent.match(/Edge\/(\d{2})\./),e=t?parseInt(t[1],10):null,n=!!e&&(16<=e&&e<=18);if(!("objectFit"in document.documentElement.style!=!1)||n){var o=function(t,e,i){var n,o,l,a,d;if((i=i.split(" ")).length<2&&(i[1]=i[0]),"x"===t)n=i[0],o=i[1],l="left",a="right",d=e.clientWidth;else{if("y"!==t)return;n=i[1],o=i[0],l="top",a="bottom",d=e.clientHeight}if(n!==l&&o!==l){if(n!==a&&o!==a)return"center"===n||"50%"===n?(e.style[l]="50%",void(e.style["margin-"+l]=d/-2+"px")):void(0<=n.indexOf("%")?(n=parseInt(n))<50?(e.style[l]=n+"%",e.style["margin-"+l]=d*(n/-100)+"px"):(n=100-n,e.style[a]=n+"%",e.style["margin-"+a]=d*(n/-100)+"px"):e.style[l]=n);e.style[a]="0"}else e.style[l]="0"},l=function(t){var e=t.dataset?t.dataset.objectFit:t.getAttribute("data-object-fit"),i=t.dataset?t.dataset.objectPosition:t.getAttribute("data-object-position");e=e||"cover",i=i||"50% 50%";var n=t.parentNode;return function(t){var e=window.getComputedStyle(t,null),i=e.getPropertyValue("position"),n=e.getPropertyValue("overflow"),o=e.getPropertyValue("display");i&&"static"!==i||(t.style.position="relative"),"hidden"!==n&&(t.style.overflow="hidden"),o&&"inline"!==o||(t.style.display="block"),0===t.clientHeight&&(t.style.height="100%"),-1===t.className.indexOf("object-fit-polyfill")&&(t.className=t.className+" object-fit-polyfill")}(n),function(t){var e=window.getComputedStyle(t,null),i={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var n in i)e.getPropertyValue(n)!==i[n]&&(t.style[n]=i[n])}(t),t.style.position="absolute",t.style.width="auto",t.style.height="auto","scale-down"===e&&(e=t.clientWidth<n.clientWidth&&t.clientHeight<n.clientHeight?"none":"contain"),"none"===e?(o("x",t,i),void o("y",t,i)):"fill"===e?(t.style.width="100%",t.style.height="100%",o("x",t,i),void o("y",t,i)):(t.style.height="100%",void("cover"===e&&t.clientWidth>n.clientWidth||"contain"===e&&t.clientWidth<n.clientWidth?(t.style.top="0",t.style.marginTop="0",o("x",t,i)):(t.style.width="100%",t.style.height="auto",t.style.left="0",t.style.marginLeft="0",o("y",t,i))))},i=function(t){if(void 0===t||t instanceof Event)t=document.querySelectorAll("[data-object-fit]");else if(t&&t.nodeName)t=[t];else{if("object"!=typeof t||!t.length||!t[0].nodeName)return!1;t=t}for(var e=0;e<t.length;e++)if(t[e].nodeName){var i=t[e].nodeName.toLowerCase();if("img"===i){if(n)continue;t[e].complete?l(t[e]):t[e].addEventListener("load",function(){l(this)})}else"video"===i?0<t[e].readyState?l(t[e]):t[e].addEventListener("loadedmetadata",function(){l(this)}):l(t[e])}return!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i(),window.addEventListener("resize",i),window.objectFitPolyfill=i}else window.objectFitPolyfill=function(){return!1}}}();
|
!function(){"use strict";if("undefined"!=typeof window){var t=window.navigator.userAgent.match(/Edge\/(\d{2})\./),e=t?parseInt(t[1],10):null,n=!!e&&(16<=e&&e<=18);if(!("objectFit"in document.documentElement.style!=!1)||n){var o=function(t,e,i){var n,o,l,a,d;if((i=i.split(" ")).length<2&&(i[1]=i[0]),"x"===t)n=i[0],o=i[1],l="left",a="right",d=e.clientWidth;else{if("y"!==t)return;n=i[1],o=i[0],l="top",a="bottom",d=e.clientHeight}if(n!==l&&o!==l){if(n!==a&&o!==a)return"center"===n||"50%"===n?(e.style[l]="50%",void(e.style["margin-"+l]=d/-2+"px")):void(0<=n.indexOf("%")?(n=parseInt(n,10))<50?(e.style[l]=n+"%",e.style["margin-"+l]=d*(n/-100)+"px"):(n=100-n,e.style[a]=n+"%",e.style["margin-"+a]=d*(n/-100)+"px"):e.style[l]=n);e.style[a]="0"}else e.style[l]="0"},l=function(t){var e=t.dataset?t.dataset.objectFit:t.getAttribute("data-object-fit"),i=t.dataset?t.dataset.objectPosition:t.getAttribute("data-object-position");e=e||"cover",i=i||"50% 50%";var n=t.parentNode;return function(t){var e=window.getComputedStyle(t,null),i=e.getPropertyValue("position"),n=e.getPropertyValue("overflow"),o=e.getPropertyValue("display");i&&"static"!==i||(t.style.position="relative"),"hidden"!==n&&(t.style.overflow="hidden"),o&&"inline"!==o||(t.style.display="block"),0===t.clientHeight&&(t.style.height="100%"),-1===t.className.indexOf("object-fit-polyfill")&&(t.className=t.className+" object-fit-polyfill")}(n),function(t){var e=window.getComputedStyle(t,null),i={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var n in i)e.getPropertyValue(n)!==i[n]&&(t.style[n]=i[n])}(t),t.style.position="absolute",t.style.width="auto",t.style.height="auto","scale-down"===e&&(e=t.clientWidth<n.clientWidth&&t.clientHeight<n.clientHeight?"none":"contain"),"none"===e?(o("x",t,i),void o("y",t,i)):"fill"===e?(t.style.width="100%",t.style.height="100%",o("x",t,i),void o("y",t,i)):(t.style.height="100%",void("cover"===e&&t.clientWidth>n.clientWidth||"contain"===e&&t.clientWidth<n.clientWidth?(t.style.top="0",t.style.marginTop="0",o("x",t,i)):(t.style.width="100%",t.style.height="auto",t.style.left="0",t.style.marginLeft="0",o("y",t,i))))},i=function(t){if(void 0===t||t instanceof Event)t=document.querySelectorAll("[data-object-fit]");else if(t&&t.nodeName)t=[t];else{if("object"!=typeof t||!t.length||!t[0].nodeName)return!1;t=t}for(var e=0;e<t.length;e++)if(t[e].nodeName){var i=t[e].nodeName.toLowerCase();if("img"===i){if(n)continue;t[e].complete?l(t[e]):t[e].addEventListener("load",function(){l(this)})}else"video"===i?0<t[e].readyState?l(t[e]):t[e].addEventListener("loadedmetadata",function(){l(this)}):l(t[e])}return!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i(),window.addEventListener("resize",i),window.objectFitPolyfill=i}else window.objectFitPolyfill=function(){return!1}}}();
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.8-alpha-50614';
|
$wp_version = '5.8-alpha-50615';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue