-
Notifications
You must be signed in to change notification settings - Fork 27.4k
support SVG templates #6778
Comments
you created this patch with mercurial? scratches head. Anyways, if I'm understanding this correctly, you're wanting to support SVG templates. What is the reason for the SVGElement wrapper? I'm not sure that's something that is needed. In any case, if a template contains SVG markup, but no parent In any case, you should clone the actual angular repository and author these changes using git, and submit a pull request. This way, if it's easier to review, and you'll actually end up in the change history of the repository. |
Object.defineProperty (SVGElement.prototype, 'innerHTML', { 'ownerSVGElement' in $ compileNode [0] is very fast I use svg templates in my project. This is analogous MS Visio. |
yes mercurial |
function directiveTemplateContents () to do the same with the table context |
It's not the performance that's the issue, the issue is, if I have a template like this: <g>
<text>Hello, world</text>
</g> Those nodes will not automatically become If the template does actually contain a parent We could extend the directive API to add an optional namespace property or something, but it seems a bit late in the game for this, so I'm not sure this is the right thing to do. |
And yes, I wrote the function to support table elements, but the thing with table elements is that they can be detected by regular expressions, because their names are not shared in MathML or SVG or other XML dialects fused into HTML5. But with SVG, you have a lot more element names to deal with, and some of them overlap with regular HTML, creating ambiguities (like Believe me, I would love to support arbitrary SVG templates, but HTML5 has made this a sort of difficult thing to do. |
for example <svg>
<g class="element-pane no-user-select gluck-hide">
<rect class="origin-selection-rect" x="0" y="0" height="100%" width="100%" style="fill:white;fill-opacity: 0;" ng-mousedown="onMouseDown($event)"></rect>
<g ng-repeat="element in elements">
<block element="element"/>
</g>
<rect class="drag-selection-rect" x="0" y="0" height="0" width="0"></rect>
<g ng-repeat="gluck in glucks | orderBy:'range'" gluck="gluck"></g>
</g>
</svg> templates/block.html <g id="{{obj.id}}">
<path class="source" d="{{obj.sourcePath.toString()}}"/>
<defs ng-if="obj.textPath">
<path id="textPath_{{obj.id}}" d="obj.textPath"/>
</defs>
<text>
<textPath xlink:href="#textPath">Text on a Path</textPath>
</text>
<g ng-transclude></g>
<!--<path ng-repeat="(key, resizer) in obj.dragResizers" class="drag-points" d="{{resizer.path.toString()}}"/>-->
<path ng-if="obj.drawResizersPath" class="draw-resizers" d="{{obj.drawResizersPath.toString()}}" style="marker:url(#connector)"/>
<path ng-if="obj.dragPointsPath" class="drag-points" d="{{obj.dragPointsPath.toString()}}" style="marker:url(#connector)"/>
</g> |
basiс angular.js block replaced HTML nodes. After this patch block replaced SVG nodes. In both embodiments innerHTML equal |
I don't think so, but I'll see what people think about it. |
Yeah, you're right, looking at it again you're checking the parent node, so if it's inserted into an SVG, it should be svg-ified. That works. I still don't think we want the innerHTML shim, though. This can be implemented better. In Mozilla's implementation (at least, as documented on mdn), SVGElements already have a perfectly valid |
@sussh - I would suggest that this idea needs to be presented as a GitHub Pull Request with associated tests so that we can confirm how well it works across the browsers that we support |
Yep, pete is right on the money there. If you want help I can pair with you to fix this up and test it |
I believe this is more or less fixed, is it not? |
Please re-open if there are still issues relating to this with 1.3 |
bower.json
The text was updated successfully, but these errors were encountered: