How to use <html xmlns=“http://www.w3.org/2000/svg” xmlns:xlink=“http://www.w3.org/1999/xlink” lang=“en”> 04

688    Asked by ChloeBurgess in Salesforce , Asked on Apr 23, 2021

I was going thru Trailhead module in SDLS. There it is mentioned 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 Salesforce Lightning Design System Trailhead Module Even the code written in tag also does not create any difference . ExcePt the tag ,which is required to include slds. IF it doesn't create any difference then why to use it ?


Answered by Brian Kennedy

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 xmlns="http://www.w3.org/2000/svg" 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 and xhtml i would suggest you read some articles on the subject such as this one.



Your Answer

Interviews

Parent Categories