- added support to clone manually built text elements -> __TODO!__
- using `CustomEvent` instead of `Event` to be able to fire events with a `detail` object [thanks @Fuzzyma]
- added polyfill for IE9 and IE10 custom events [thanks @Fuzzyma]
-- added DOM query selector with the `select()` method on parent elements
+- added DOM query selector with the `select()` method globally or on parent elements
# 1.0.0-rc.9 (17/06/2014)
-/* svg.js 1.0.0-rc.10-8-g0bb294a - svg inventor adopter regex utilities default color array pointarray patharray number viewbox bbox rbox element parent container fx relative event defs group arrange mask clip gradient pattern doc spof shape symbol use rect ellipse line poly path image text textpath nested hyperlink marker sugar set data memory selector loader helpers polyfill - svgjs.com/license */
+/* svg.js 1.0.0-rc.10-9-g1953dbc - svg inventor adopter regex utilities default color array pointarray patharray number viewbox bbox rbox element parent container fx relative event defs group arrange mask clip gradient pattern doc spof shape symbol use rect ellipse line poly path image text textpath nested hyperlink marker sugar set data memory selector loader helpers polyfill - svgjs.com/license */
;(function() {
var SVG = this.SVG = function(element) {
</head>
<body>
+ <svg height="0" width="0">
+ <path id="lineAB" d="M 100 350 l 150 -300" stroke="red" stroke-width="3" fill="none" />
+ <path id="lineBC" d="M 250 50 l 150 300" stroke="red" stroke-width="3" fill="none" />
+ <path d="M 175 200 l 150 0" stroke="green" stroke-width="3" fill="none" />
+ <path d="M 100 350 q 150 -300 300 0" stroke="blue" stroke-width="5" fill="none" />
+ <g stroke="black" stroke-width="3" fill="black">
+ <circle id="pointA" cx="100" cy="350" r="3" />
+ <circle id="pointB" cx="250" cy="50" r="3" />
+ <circle id="pointC" cx="400" cy="350" r="3" />
+ </g>
+ <g font-size="30" font="sans-serif" fill="black" stroke="none" text-anchor="middle">
+ <text x="100" y="350" dx="-30">A</text>
+ <text x="250" y="50" dy="-10">B</text>
+ <text x="400" y="350" dx="30">C</text>
+ </g>
+ </svg>
</body>
<script type="text/javascript" src="lib/jasmine-1.3.1/jasmine.js"></script>
<!-- include spec files here... -->
<script type="text/javascript" src="spec/svg.js"></script>
<script type="text/javascript" src="spec/selector.js"></script>
+<script type="text/javascript" src="spec/adopter.js"></script>
<script type="text/javascript" src="spec/regex.js"></script>
<script type="text/javascript" src="spec/container.js"></script>
<script type="text/javascript" src="spec/element.js"></script>
--- /dev/null
+describe('Adopter', function() {
+ var path
+
+ beforeEach(function() {
+ path = SVG.get('lineAB')
+ })
+
+ it('adopts an exiting path element', function() {
+ expect(path instanceof SVG.Path).toBe(true)
+ })
+
+ it('modifies an adopted element', function() {
+ path.fill('#f06')
+ expect(path.node.getAttribute('fill')).toBe('#ff0066')
+ })
+
+ it('adopts a parent when parent() method is called', function() {
+ expect(path.parent() instanceof SVG.Doc).toBe(true)
+ })
+
+})
\ No newline at end of file