-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a setting
preserveStyleIncludes
which, when used with a shadow…
… dom targeted css build and native custom properties, will copy styles into the Shadow DOM template rather than collapsing them into a single style. This will (1) allow the browser to optimize parsing of shared styles because they remain intact, (2) reduce the size of the css build resources when shared styles are used since they are not pre-collapsed. This option does perform registration runtime work to add included styles to element templates.
- Loading branch information
Steven Orvell
committed
Feb 22, 2017
1 parent
6fc567f
commit 2315547
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title></title> | ||
<script> | ||
Polymer = { | ||
preserveStyleIncludes: true | ||
} | ||
</script> | ||
<link rel="import" href="../../polymer.html"> | ||
</head> | ||
<body> | ||
<dom-module id="include4"> | ||
<template> | ||
<style> | ||
:host { | ||
color: red; | ||
} | ||
</style> | ||
<style></style> | ||
</template> | ||
</dom-module> | ||
|
||
<dom-module id="include2"> | ||
<template> | ||
<style> | ||
:host { | ||
margin: 10px; | ||
} | ||
</style> | ||
<style></style> | ||
</template> | ||
</dom-module> | ||
|
||
<dom-module id="include1"> | ||
<template> | ||
<style include="include2 include3"> | ||
:host { | ||
padding: 10px; | ||
} | ||
</style> | ||
<style include="include4"></style> | ||
</template> | ||
</dom-module> | ||
|
||
<dom-module id="x-test"> | ||
<template> | ||
<style include="include1"> | ||
:host { | ||
display: block; | ||
background: green; | ||
} | ||
|
||
</style> | ||
<div>Hi</div> | ||
</template> | ||
<script> | ||
Polymer({ | ||
is: 'x-test' | ||
}); | ||
</script> | ||
</dom-module> | ||
|
||
|
||
<x-test></x-test> | ||
</body> | ||
</html> |