@wordpress/dom
Advanced tools
Comparing version 3.14.0 to 3.15.0
/** | ||
* External dependencies | ||
*/ | ||
import { includes } from 'lodash'; | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import isEmpty from './is-empty'; | ||
@@ -76,3 +71,3 @@ import remove from './remove'; | ||
if (name !== 'class' && !includes(attributes, name)) { | ||
if (name !== 'class' && !attributes.includes(name)) { | ||
node.removeAttribute(name); | ||
@@ -79,0 +74,0 @@ } |
/** | ||
* External dependencies | ||
*/ | ||
import { omit, without } from 'lodash'; | ||
/** | ||
* All phrasing content elements. | ||
@@ -28,3 +24,2 @@ * | ||
*/ | ||
const textContentSchema = { | ||
@@ -83,4 +78,9 @@ strong: {}, | ||
without(Object.keys(textContentSchema), '#text', 'br').forEach(tag => { | ||
textContentSchema[tag].children = omit(textContentSchema, tag); | ||
const excludedElements = ['#text', 'br']; | ||
Object.keys(textContentSchema).filter(element => !excludedElements.includes(element)).forEach(tag => { | ||
const { | ||
[tag]: removedTag, | ||
...restSchema | ||
} = textContentSchema; | ||
textContentSchema[tag].children = restSchema; | ||
}); | ||
@@ -139,4 +139,24 @@ /** | ||
} | ||
/** | ||
* @type {Partial<ContentSchema>} | ||
*/ | ||
return omit({ ...phrasingContentSchema, | ||
const { | ||
u, | ||
// Used to mark misspelling. Shouldn't be pasted. | ||
abbr, | ||
// Invisible. | ||
data, | ||
// Invisible. | ||
time, | ||
// Invisible. | ||
wbr, | ||
// Invisible. | ||
bdi, | ||
// Invisible. | ||
bdo, | ||
// Invisible. | ||
...remainingContentSchema | ||
} = { ...phrasingContentSchema, | ||
// We shouldn't paste potentially sensitive information which is not | ||
@@ -150,10 +170,4 @@ // visible to the user when pasted, so strip the attributes. | ||
} | ||
}, ['u', // Used to mark misspelling. Shouldn't be pasted. | ||
'abbr', // Invisible. | ||
'data', // Invisible. | ||
'time', // Invisible. | ||
'wbr', // Invisible. | ||
'bdi', // Invisible. | ||
'bdo' // Invisible. | ||
]); | ||
}; | ||
return remainingContentSchema; | ||
} | ||
@@ -160,0 +174,0 @@ /** |
/** | ||
* External dependencies | ||
*/ | ||
import { without, first, last } from 'lodash'; | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { find as findFocusable } from './focusable'; | ||
@@ -82,3 +77,3 @@ /** | ||
const hadChosenElement = CHOSEN_RADIO_BY_NAME[name]; | ||
result = without(result, hadChosenElement); | ||
result = result.filter(e => e !== hadChosenElement); | ||
} | ||
@@ -184,3 +179,4 @@ | ||
focusables.length = index; | ||
return last(filterTabbable(focusables)); | ||
const tabbable = filterTabbable(focusables); | ||
return tabbable[tabbable.length - 1]; | ||
} | ||
@@ -192,2 +188,4 @@ /** | ||
* to the active element. | ||
* | ||
* @return {Element|undefined} Next tabbable element. | ||
*/ | ||
@@ -200,4 +198,4 @@ | ||
const remaining = focusables.slice(index + 1); | ||
return first(filterTabbable(remaining)); | ||
return filterTabbable(remaining)[0]; | ||
} | ||
//# sourceMappingURL=tabbable.js.map |
@@ -28,2 +28,4 @@ /** | ||
* to the active element. | ||
* | ||
* @return {Element|undefined} Next tabbable element. | ||
*/ | ||
@@ -30,0 +32,0 @@ export function findNext(element: Element): Element | undefined; |
@@ -10,4 +10,2 @@ "use strict"; | ||
var _lodash = require("lodash"); | ||
var _isEmpty = _interopRequireDefault(require("./is-empty")); | ||
@@ -26,6 +24,2 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
/** | ||
* Internal dependencies | ||
@@ -93,3 +87,3 @@ */ | ||
if (name !== 'class' && !(0, _lodash.includes)(attributes, name)) { | ||
if (name !== 'class' && !attributes.includes(name)) { | ||
node.removeAttribute(name); | ||
@@ -96,0 +90,0 @@ } |
@@ -10,9 +10,3 @@ "use strict"; | ||
var _lodash = require("lodash"); | ||
/** | ||
* External dependencies | ||
*/ | ||
/** | ||
* All phrasing content elements. | ||
@@ -93,4 +87,9 @@ * | ||
(0, _lodash.without)(Object.keys(textContentSchema), '#text', 'br').forEach(tag => { | ||
textContentSchema[tag].children = (0, _lodash.omit)(textContentSchema, tag); | ||
const excludedElements = ['#text', 'br']; | ||
Object.keys(textContentSchema).filter(element => !excludedElements.includes(element)).forEach(tag => { | ||
const { | ||
[tag]: removedTag, | ||
...restSchema | ||
} = textContentSchema; | ||
textContentSchema[tag].children = restSchema; | ||
}); | ||
@@ -149,4 +148,24 @@ /** | ||
} | ||
/** | ||
* @type {Partial<ContentSchema>} | ||
*/ | ||
return (0, _lodash.omit)({ ...phrasingContentSchema, | ||
const { | ||
u, | ||
// Used to mark misspelling. Shouldn't be pasted. | ||
abbr, | ||
// Invisible. | ||
data, | ||
// Invisible. | ||
time, | ||
// Invisible. | ||
wbr, | ||
// Invisible. | ||
bdi, | ||
// Invisible. | ||
bdo, | ||
// Invisible. | ||
...remainingContentSchema | ||
} = { ...phrasingContentSchema, | ||
// We shouldn't paste potentially sensitive information which is not | ||
@@ -160,10 +179,4 @@ // visible to the user when pasted, so strip the attributes. | ||
} | ||
}, ['u', // Used to mark misspelling. Shouldn't be pasted. | ||
'abbr', // Invisible. | ||
'data', // Invisible. | ||
'time', // Invisible. | ||
'wbr', // Invisible. | ||
'bdi', // Invisible. | ||
'bdo' // Invisible. | ||
]); | ||
}; | ||
return remainingContentSchema; | ||
} | ||
@@ -170,0 +183,0 @@ /** |
@@ -11,11 +11,5 @@ "use strict"; | ||
var _lodash = require("lodash"); | ||
var _focusable = require("./focusable"); | ||
/** | ||
* External dependencies | ||
*/ | ||
/** | ||
* Internal dependencies | ||
@@ -96,3 +90,3 @@ */ | ||
const hadChosenElement = CHOSEN_RADIO_BY_NAME[name]; | ||
result = (0, _lodash.without)(result, hadChosenElement); | ||
result = result.filter(e => e !== hadChosenElement); | ||
} | ||
@@ -199,3 +193,4 @@ | ||
focusables.length = index; | ||
return (0, _lodash.last)(filterTabbable(focusables)); | ||
const tabbable = filterTabbable(focusables); | ||
return tabbable[tabbable.length - 1]; | ||
} | ||
@@ -207,2 +202,4 @@ /** | ||
* to the active element. | ||
* | ||
* @return {Element|undefined} Next tabbable element. | ||
*/ | ||
@@ -216,4 +213,4 @@ | ||
const remaining = focusables.slice(index + 1); | ||
return (0, _lodash.first)(filterTabbable(remaining)); | ||
return filterTabbable(remaining)[0]; | ||
} | ||
//# sourceMappingURL=tabbable.js.map |
@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
## 3.15.0 (2022-08-10) | ||
## 3.14.0 (2022-07-27) | ||
@@ -7,0 +9,0 @@ |
{ | ||
"name": "@wordpress/dom", | ||
"version": "3.14.0", | ||
"version": "3.15.0", | ||
"description": "DOM utilities module for WordPress.", | ||
@@ -32,4 +32,3 @@ "author": "The WordPress Contributors", | ||
"@babel/runtime": "^7.16.0", | ||
"@wordpress/deprecated": "^3.8.0", | ||
"lodash": "^4.17.21" | ||
"@wordpress/deprecated": "^3.8.0" | ||
}, | ||
@@ -39,3 +38,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "0315dbc240cb2aa146d7c1bafd251f004b88300e" | ||
"gitHead": "08358f53b627a15148c3a3e433cdf58cf8714aa4" | ||
} |
/** | ||
* External dependencies | ||
*/ | ||
import { includes } from 'lodash'; | ||
/** | ||
* Internal dependencies | ||
@@ -73,3 +68,3 @@ */ | ||
name !== 'class' && | ||
! includes( attributes, name ) | ||
! attributes.includes( name ) | ||
) { | ||
@@ -76,0 +71,0 @@ node.removeAttribute( name ); |
/** | ||
* External dependencies | ||
*/ | ||
import { omit, without } from 'lodash'; | ||
/** | ||
* All phrasing content elements. | ||
@@ -67,5 +62,9 @@ * | ||
// Impossible: strong > strong. | ||
without( Object.keys( textContentSchema ), '#text', 'br' ).forEach( ( tag ) => { | ||
textContentSchema[ tag ].children = omit( textContentSchema, tag ); | ||
} ); | ||
const excludedElements = [ '#text', 'br' ]; | ||
Object.keys( textContentSchema ) | ||
.filter( ( element ) => ! excludedElements.includes( element ) ) | ||
.forEach( ( tag ) => { | ||
const { [ tag ]: removedTag, ...restSchema } = textContentSchema; | ||
textContentSchema[ tag ].children = restSchema; | ||
} ); | ||
@@ -155,20 +154,23 @@ /** | ||
return omit( | ||
{ | ||
...phrasingContentSchema, | ||
// We shouldn't paste potentially sensitive information which is not | ||
// visible to the user when pasted, so strip the attributes. | ||
ins: { children: phrasingContentSchema.ins.children }, | ||
del: { children: phrasingContentSchema.del.children }, | ||
}, | ||
[ | ||
'u', // Used to mark misspelling. Shouldn't be pasted. | ||
'abbr', // Invisible. | ||
'data', // Invisible. | ||
'time', // Invisible. | ||
'wbr', // Invisible. | ||
'bdi', // Invisible. | ||
'bdo', // Invisible. | ||
] | ||
); | ||
/** | ||
* @type {Partial<ContentSchema>} | ||
*/ | ||
const { | ||
u, // Used to mark misspelling. Shouldn't be pasted. | ||
abbr, // Invisible. | ||
data, // Invisible. | ||
time, // Invisible. | ||
wbr, // Invisible. | ||
bdi, // Invisible. | ||
bdo, // Invisible. | ||
...remainingContentSchema | ||
} = { | ||
...phrasingContentSchema, | ||
// We shouldn't paste potentially sensitive information which is not | ||
// visible to the user when pasted, so strip the attributes. | ||
ins: { children: phrasingContentSchema.ins.children }, | ||
del: { children: phrasingContentSchema.del.children }, | ||
}; | ||
return remainingContentSchema; | ||
} | ||
@@ -175,0 +177,0 @@ |
/** | ||
* External dependencies | ||
*/ | ||
import { without, first, last } from 'lodash'; | ||
/** | ||
* Internal dependencies | ||
@@ -77,3 +72,3 @@ */ | ||
const hadChosenElement = CHOSEN_RADIO_BY_NAME[ name ]; | ||
result = without( result, hadChosenElement ); | ||
result = result.filter( ( e ) => e !== hadChosenElement ); | ||
} | ||
@@ -178,3 +173,4 @@ | ||
return last( filterTabbable( focusables ) ); | ||
const tabbable = filterTabbable( focusables ); | ||
return tabbable[ tabbable.length - 1 ]; | ||
} | ||
@@ -187,2 +183,4 @@ | ||
* to the active element. | ||
* | ||
* @return {Element|undefined} Next tabbable element. | ||
*/ | ||
@@ -196,3 +194,3 @@ export function findNext( element ) { | ||
return first( filterTabbable( remaining ) ); | ||
return filterTabbable( remaining )[ 0 ]; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2
6831
531321
- Removedlodash@^4.17.21
- Removedlodash@4.17.21(transitive)