Address issue in which slashes weren't being appropriately trimmed for p...

Addresses https://github.com/yui/yui3/issues/1964

@caridy @ericf @juandopazo 

Is this because of a bug in some browser with array-like access on strings or because `key` may have spaces at either end?