@@ -279,15 +279,17 @@ export class HtmlTagDefinition {
279279 public implicitNamespacePrefix : string ;
280280 public contentType : HtmlTagContentType ;
281281 public isVoid : boolean ;
282+ public ignoreFirstLf : boolean ;
282283
283284 constructor ( { closedByChildren, requiredParents, implicitNamespacePrefix, contentType,
284- closedByParent, isVoid} : {
285+ closedByParent, isVoid, ignoreFirstLf } : {
285286 closedByChildren ?: string [ ] ,
286287 closedByParent ?: boolean ,
287288 requiredParents ?: string [ ] ,
288289 implicitNamespacePrefix ?: string ,
289290 contentType ?: HtmlTagContentType ,
290- isVoid ?: boolean
291+ isVoid ?: boolean ,
292+ ignoreFirstLf ?: boolean
291293 } = { } ) {
292294 if ( isPresent ( closedByChildren ) && closedByChildren . length > 0 ) {
293295 closedByChildren . forEach ( tagName => this . closedByChildren [ tagName ] = true ) ;
@@ -301,6 +303,7 @@ export class HtmlTagDefinition {
301303 }
302304 this . implicitNamespacePrefix = implicitNamespacePrefix ;
303305 this . contentType = isPresent ( contentType ) ? contentType : HtmlTagContentType . PARSABLE_DATA ;
306+ this . ignoreFirstLf = normalizeBool ( ignoreFirstLf ) ;
304307 }
305308
306309 requireExtraParent ( currentParent : string ) : boolean {
@@ -388,10 +391,13 @@ var TAG_DEFINITIONS: {[key: string]: HtmlTagDefinition} = {
388391 'rp' : new HtmlTagDefinition ( { closedByChildren : [ 'rb' , 'rt' , 'rtc' , 'rp' ] , closedByParent : true } ) ,
389392 'optgroup' : new HtmlTagDefinition ( { closedByChildren : [ 'optgroup' ] , closedByParent : true } ) ,
390393 'option' : new HtmlTagDefinition ( { closedByChildren : [ 'option' , 'optgroup' ] , closedByParent : true } ) ,
394+ 'pre' : new HtmlTagDefinition ( { ignoreFirstLf : true } ) ,
395+ 'listing' : new HtmlTagDefinition ( { ignoreFirstLf : true } ) ,
391396 'style' : new HtmlTagDefinition ( { contentType : HtmlTagContentType . RAW_TEXT } ) ,
392397 'script' : new HtmlTagDefinition ( { contentType : HtmlTagContentType . RAW_TEXT } ) ,
393398 'title' : new HtmlTagDefinition ( { contentType : HtmlTagContentType . ESCAPABLE_RAW_TEXT } ) ,
394- 'textarea' : new HtmlTagDefinition ( { contentType : HtmlTagContentType . ESCAPABLE_RAW_TEXT } ) ,
399+ 'textarea' : new HtmlTagDefinition (
400+ { contentType : HtmlTagContentType . ESCAPABLE_RAW_TEXT , ignoreFirstLf : true } ) ,
395401} ;
396402
397403var DEFAULT_TAG_DEFINITION = new HtmlTagDefinition ( ) ;
0 commit comments