2

I was going thru Trailhead module in SDLS.

There it is mentioned

<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en">

Can someone tell what is the use of this tag. Bcoz even if I remove this from code ,still the output is same.

My code from trailhead :-

Salesforce Lightning Design System Trailhead Module

<!-- MASTHEAD -->
<p class="slds-text-heading--label slds-m-bottom--small">
  Salesforce Lightning Design System Trailhead Module
</p>

Even the code written in tag also doesnt create any difference . ExcePt the tag ,which is required to include slds. IF it doesnt create any difference then why to use it ?

2

2 Answers 2

1

From https://www.w3schools.com/tags/att_html_xmlns.asp

The xmlns attribute specifies the xml namespace for a document.

Note: The xmlns attribute is required in XHTML, invalid in HTML 4.01, and optional in HTML5. Note: The HTML validator at http://w3.org does not complain when the xmlns attribute is missing in an XHTML document.

XML namespaces are used for providing uniquely named elements and attributes in an XML document. They are defined in a W3C recommendation. An XML instance may contain element or attribute names from more than one XML vocabulary.

From the trailhead module itself:

On your html tag, be sure to include the xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"attributes. This is important to enable support for the SVG icon sprite maps within visualforce.

If there are no changes in between adding it or not. Try removing the tag and rendering the page after clearing browser cache or in incognito mode.

You are using the attribute correctly. It basically declares your page as being an xhtml document. To better understand the difference between html amd xhtml i would suggest you read some articles on the subject such as this one.

1
  • 1
    Also, any part of the page containing an svg that is being refendered must have the xmlns attributes on the element containing the svg or your page will halt on you. I thought it was fix but just ran into it again last week
    – Eric
    Jun 18, 2017 at 18:33
0

This tag was used earlier to support svg icons into your VF page or in lightning components.

But now there are two tags called apex:slds and lightning:icon being introduced which can call the svg icons onto your page without the html tag here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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