Secluded `castAttribute` from `extend`

It's useful on its own
replaceContent doesn't replace nodes if not needed