Sorry, my mistake, so I'm answering my own enquiry.
The line should not read "ce.setAttribute(ce.selection() [0], 'Pop', 99)" but rather "ce.setAttribute(ce.selection, 'Pop', 99)". No "() [0]" is required, this would limit the setAttribute function to the first item in the selection set, removing that it allowed the setAttribute to act on all objects in the selection.