//--------------------------------------
//               PowerUI
//
//        For documentation or 
//    if you have any issues, visit
//        powerUI.kulestar.com
//
//    Copyright  2013 Kulestar Ltd
//          www.kulestar.com
//--------------------------------------

using Dom;


namespace PowerUI{
	
	/// <summary>
	/// Represents a nobr element.
	/// </summary>
	
	[Dom.TagName("nobr")]
	public class HtmlNoBrElement:HtmlElement{
		
		/// <summary>Called when this node has been created and is being added to the given lexer.</summary>
		public override bool OnLexerAddNode(HtmlLexer lexer,int mode){
			
			if(mode==HtmlTreeMode.InBody){
				
				lexer.ReconstructFormatting();
				
				if(lexer.IsInScope("nobr")){
					
					// (Parse error)
					lexer.AdoptionAgencyAlgorithm("nobr");
					
					lexer.ReconstructFormatting();
					
				}
				
				lexer.Push(this,true);
				lexer.AddFormatting(this);
				
			}else{
				return false;
			}
			
			return true;
			
		}
		
		/// <summary>Called when a close tag of this element has 
		/// been created and is being added to the given lexer.</summary>
		/// <returns>True if this element handled itself.</returns>
		public override bool OnLexerCloseNode(HtmlLexer lexer,int mode){
			
			if(mode==HtmlTreeMode.InBody){
				
				lexer.AdoptionAgencyAlgorithm("nobr");
				
			}else{
			
				return false;
			
			}
			
			return true;
			
		}
		
	}
	
}