port htmlmixed code
[htmlmixed mode] Integrate support for different script types

Issue #1198