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

using System;
using PowerUI;


namespace Css{
	
	/// <summary>
	/// Describes if this element is on a world UI. E.g. html:world-ui{}
	/// See also IsMainUI.
	/// <summary>
	
	sealed class IsWorldUI:CssKeyword{
		
		public override string Name{
			get{
				return "world-ui";
			}
		}
		
		public override SelectorMatcher GetSelectorMatcher(){
			return new WorldUIMatcher();
		}
		
	}
	
	/// <summary>
	/// Handles the matching process for :world-ui.
	/// </summary>
	
	sealed class WorldUIMatcher:LocalMatcher{
		
		public override bool TryMatch(Dom.Node node){
			
			if(node==null){
				return false;
			}
			
			HtmlDocument htmlDoc=(node.document as HtmlDocument);
			
			if(htmlDoc==null){
				return false;
			}
			
			return (htmlDoc!=UI.document);
			
		}
		
	}
	
}