Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created November 27, 2012 19:05
Show Gist options
  • Save tmcw/4156302 to your computer and use it in GitHub Desktop.
Save tmcw/4156302 to your computer and use it in GitHub Desktop.
Camelcase selectors
<!DOCTYPE html>
<meta charset='utf-8'>
<title>SVG Swarm</title>
<style>
svg {
position: absolute;
top: 0;
}
</style>
<h2>found camelcase: <span id='camelcase'></span></h2>
<h2>found lowercase: <span id='lowercase'></span></h2>
<script src='http://d3js.org/d3.v2.min.js?2.9.1'></script>
<script>
var svg = d3.select('body').append('svg')
.attr('width', 100)
.attr('height', 100);
svg.append('text').append('textPath');
d3.select('#camelcase').text(!svg.selectAll('textPath').empty());
svg.append('text').append('textpath');
d3.select('#lowercase').text(!svg.selectAll('textpath').empty());
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment