-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0406f3
commit c82fa09
Showing
13 changed files
with
101 additions
and
71 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 7 additions & 15 deletions
22
src/Components/Web.JS/src/Rendering/DomMerging/DataPermanentElementSync.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
const dataPermanentAttributeName = 'data-permanent'; | ||
|
||
export function isDataPermanentElement(elem: Element): boolean { | ||
return elem.hasAttribute('data-permanent'); | ||
return elem.hasAttribute(dataPermanentAttributeName); | ||
} | ||
|
||
export function areIncompatibleDataPermanentElements(elementA: Element, elementB: Element) { | ||
const isDataPermanentA = isDataPermanentElement(elementA); | ||
const isDataPermanentB = isDataPermanentElement(elementB); | ||
|
||
if (isDataPermanentA !== isDataPermanentB) { | ||
// A 'data permanent' element can't be merged with a 'non-data-permanent' one. | ||
return true; | ||
} | ||
|
||
if (isDataPermanentA && elementA.id !== elementB.id) { | ||
// Data permanent elements with different IDs can't be merged. | ||
return true; | ||
} | ||
export function cannotMergeDueToDataPermanentAttributes(elementA: Element, elementB: Element) { | ||
const dataPermanentAttributeValueA = elementA.getAttribute(dataPermanentAttributeName); | ||
const dataPermanentAttributeValueB = elementB.getAttribute(dataPermanentAttributeName); | ||
|
||
return false; | ||
return dataPermanentAttributeValueA !== dataPermanentAttributeValueB; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters