This file contains hidden or 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
<div id="clExample" class="red green bold"></div> |
This file contains hidden or 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
>>> var clNode = document.getElementById('clExample'); | |
>>> clNode.classList | |
// ['red', 'green', 'bold'] | |
>>> clNode.classList.length | |
3 | |
>>> clNode.classList.remove('bold') | |
// Now the classList is ['red', 'green'] |
This file contains hidden or 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
div[data-author-name="Dave"] { | |
background-color: blue; | |
} |
This file contains hidden or 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
>>> var ds = document.getElementById('gallery-image1').dataset; | |
>>> delete ds.authorName; | |
true | |
>>> document.getElementById('gallery-image1').dataset.authorName; | |
undefined |
This file contains hidden or 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
>>> var ds = document.getElementById('gallery-image1').dataset; | |
>>> ds.authorName = 'David'; | |
"David" |
This file contains hidden or 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
>>> var ds = document.getElementById('gallery-image1').dataset; | |
>>> ds.authorName; | |
"Dave" | |
>>> ds.location; | |
"Austin, TX" | |
>>> ds.date; | |
"August 14th, 2011" |
This file contains hidden or 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
<div id="gallery-image1" | |
data-date="August 14th, 2011" | |
data-location="Austin, TX" | |
data-author-name="Dave">Gallery Image 1</div> |
This file contains hidden or 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
final Joiner joiner = Joiner.on(",") | |
.skipNulls(); | |
StringBuilder builder = new StringBuilder(); | |
final String[] input1 = new String[] {"dave", "john"}; | |
builder = joiner.appendTo(builder, input1); | |
// Dave and John have a comma between them. | |
final String[] input2 = new String[]{null, "dan"}; |
This file contains hidden or 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
final String[] input = new String[] {"dave", "john", | |
null, "dan", null, "matt"}; | |
final String resultSkip = Joiner.on(",") | |
.skipNulls() | |
.join(input); | |
// resultSkip = "dave,john,dan,matt" | |
final String resultUseForNull = Joiner.on(",") | |
.useForNull("<blank>") |
This file contains hidden or 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
final String[] input = new String[] {"dave", "john", "dan", "matt"}; | |
final String result = Joiner.on(",") | |
.join(input); | |
// "dave,john,dan,matt" |
NewerOlder