MCPcopy
hub / github.com/basecamp/trix / getBlockAttributes

Method getBlockAttributes

src/trix/models/html_parser.js:334–353  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

332 }
333
334 getBlockAttributes(element) {
335 const attributes = []
336 while (element && element !== this.containerElement) {
337 for (const attribute in config.blockAttributes) {
338 const attrConfig = config.blockAttributes[attribute]
339 if (attrConfig.parse !== false) {
340 if (tagName(element) === attrConfig.tagName) {
341 if (attrConfig.test?.(element) || !attrConfig.test) {
342 attributes.push(attribute)
343 if (attrConfig.listAttribute) {
344 attributes.push(attrConfig.listAttribute)
345 }
346 }
347 }
348 }
349 }
350 element = element.parentNode
351 }
352 return attributes.reverse()
353 }
354
355 getBlockHTMLAttributes(element) {
356 const attributes = {}

Callers 2

appendBlockForElementMethod · 0.95

Calls 2

tagNameFunction · 0.90
testMethod · 0.80

Tested by

no test coverage detected