The Mediator Pattern: Namespace issues when implementing mediator.js
===

I have a web page (php) which handles a series of ajax forms and simple js hide/show divs based on content from an external upload to be used by registered members of an organization.  In order to build a more maintainable and extendable site, I have been looking into using architectural patterns to prevent unending jQuery chaining; namely, the mediator pattern. 

Has anyone used Jack Lawson's [Mediator.js][1]? Basically, you can Subscribe with the Mediator to listen on a "channel" (namespaces) with a function to be run when something is Published on that same channel (and even check a predicate true/false function before responding, if needed).   

**The Goal:**
The mediator.js api seems like it has great potential as well as forcing me to implement a valid xhtml document and use namespaces correctly.  Implementing a mediator pattern seems like a great way to decouple the javascript code and make a complicated web-app much more maintainable and extendable in the future. 

**The Frustration:** 
I believe I understand both namespaces and the mediator pattern as implemented by the mediator.js api.  I have been able to successfully publish DOM attribute events through a mediator on specific "channels" (namespaces) and Subscribe to those channels and react to them - even using the mediator.js method of testing a "predicate" on that channel in order to ascertain whether a response is necessary.  But my CSS is now incapable of recognizing elements due to the new namespaces.  

I created namespaces like this:

> <  xmlns:active='http://www.ttl.com/tracks/active'  
> xmlns:completed='http://www.ttl.com/tracks/completed'  
> xmlns:inactive='http://www.ttl.com/tracks/inactive' >

and then applying them to html elements, like:

> < active:div ...>stuff< /active:div>

break the css formatting?  Even though the css has been changed to:

> active|div {   css formatting }

The doctype portion of the rendered page looks like:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">

I am not entirely sure this isn't required, but I have tried adding:

    <? header('Content-Type: application/xhtml+xml'); ?>

Which produces an XML parsing error of:

> XML Parsing Error: not well-formed

which points to the equal sign in this namespace definition `xmlns:active='http://www.xxx.com/tracks/active'` as the problem, but every doc I read shows this as being correct syntax.  

**Questions:**

 1. Why is my CSS broken after implementing the namespaces I showed
    above? 
 2. Why, when I add the `<? header('Content-Type:
    application/xhtml+xml'); ?>` in the header, do I get the parsing error
    mentioned?


Thank you for any help.

  [1]: http://thejacklawson.com/Mediator.js/mediator.html