wiselinks
wiselinks copied to clipboard
Response headers X-Wiselinks-Title, X-Wiselinks-Description, etc is not processed
when Wiselnks use as target a standard container (body). Reason of this is a simple: _response.js.coffee
_extract_title: ->
if @_is_full_document_response()
$('title', @_get_doc()).text()
else
@xhr.getResponseHeader('X-Wiselinks-Title')
_is_full_document_response: ->
@_get_doc_target_node().length is 1
_get_doc_target_node: ->
@$doc_target_node ?= $(@$target.selector, @_get_doc())
_get_doc: ->
@_doc ?= Response._get_document_parser().parse(@html)
_get_doc always return document with a body element. As result, we have _is_full_document_response => true. Is this a really correct behavior?
No, of course it is not correct.
Workaround: add class attribute to the body tag and use corresponding selector as a target.
Спасибо за Вашу работу.
With this fix i'm at least able to set the title using the header. But shouldn't the header be optional? If i don't set the header in the current version it gets set to an empty string. If i use Novik's patch it gets set to 'null'. I would expect that if i don't set the header the title should just stay.