use selected element instead of document
Merge pull request #2 from where/DE22957-fix

DE22957 fix