Take the 2-minute tour ×
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It's 100% free, no registration required.

While playing around with manually injecting XPM markup in rendered HTML I have noticed that it doesn't seem to matter what element precedes the HTML comments, as long as there is a container element that makes 'sense'. For example the following simple example enables a component presentation and heading, image and summary fields to be editable using <article>, <h1>, <div>, and <p> respectively:

<article>
    <!-- Start Component Presentation: {"ComponentID" : "tcm:4-82", "ComponentModified" : "2014-04-01T12:35:09", "ComponentTemplateID" : "tcm:4-83-32", "ComponentTemplateModified" : "tcm:4-83-32", "IsRepositoryPublished" : false} -->
    <h1><!-- Start Component Field: {"XPath":"tcm:Content/custom:Article/custom:headline"} -->Portugal</h1>
    <div>
        <!-- Start Component Field: {"XPath":"tcm:Content/custom:Article/custom:image"} --><img property="image" src="/media/example.jpg">
    </div>
    <p><!-- Start Component Field: {"XPath":"tcm:Content/custom:Article/custom:summary"} -->Portugal, officially the Portuguese Republic (Portuguese: República Portuguesa), is a unitary semi-presidential republic.</p>
    </div>
</article>

Does anyone know if this is coincidence, or if this is a supported feature of Experience Manager? If so, it would have significant benefits - in a lot of cases we can use the natural containers provided by the HTML design, freeing us from the restriction of only using one tag (like the default <span/>) which tends to break the HTML design and result in different markup on Staging vs Live.

share|improve this question
2  
As far as I know this is supported. I almost never use a <span>. The documentation suggests also that it's supported: sdllivecontent.sdl.com/LiveContent/content/en-US/… (But I agree that it could be stated more clearly) –  Albert Romkes Apr 3 at 8:03
    
Thanks for the doc link - I actually discovered this while playing around with your DD4T.XPM Nuget package examples - so thanks for that too! –  Will Price Apr 3 at 8:26
add comment

1 Answer 1

up vote 8 down vote accepted

XPM is intended to work with any tag, yes. The caveat is that it should be supported by the browser as a container element (and be valid in the context it is in). So basically, if you test it in the various browsers and the borders show up in the right place and you don't get any weird JavaScript errors, you're good to go.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.