I think this needs to be `span[!dir|!class], div[dir]` -- the exclamation point means spans *must* contain `dir` or `class` attributes to be valid. `extend_valid_elements` uses the same syntax as `valid_elements`: http://www.tinymce.com/wiki.php/Configuration:valid_elements (That's for TinyMCE 4.0, but 3.x is the same.) We want to keep stripping spans that have no purpose. 

Although it looks like you might have told the sanitizer to allow `dir` only on `p` and `div` tags -- am I reading that correctly? If I am, you won't want to add `dir` to `span` here, since it will just get striped by the parser anyway.

There's also an extra comma after `div[dir]`, but I'm not sure that it will hurt anything.