In order to establish separate developer orgs for package development, I'm removing namespace references from the code held by a package org. However after a Visualforce page is saved to the package org, some of the $Setup and $Label references get added a namespace prefix by Salesforce automatically. This appears like an incomplete fix for the problem already described here. E.g. I save a page with the line
{!$Setup.customsetting__c.customsettingfield__c}
and (looking at it via a web browser) Salesforce has now:
{!$Setup.namespace__customsetting__c.namespace__customsettingfield__c}
The behavior is apparently independent of the version of the page. The same happens to $Label references. And it is difficult to predict. E.g. saving
<a href="#" class="">{!$Label.Some_label}</a>
, no namespace is added. But saving
<a href="#">{!$Label.Some_label}</a>
, Salesforce adds the namespace of the package org, the line becomes:
<a href="#">{!$Label.namespace_Some_label}</a>
$Label works with and without namespace prefix. If $Setup doesn't get the namespace, it is "false" resp. empty throughout. The code displayed in the browser apparently indicates, if $Setup renders values correctly (i.e. it has a namespace prefix or not). The code downloaded via the Metadata API (e.g. downloaded via Eclipse) is just what was saved by the user.
I can sometimes use
<apex:outputText value="{!$Setup.customsetting__c.customsettingfield__c}"/>
and the namespace prefix is added consistently. But Salesforce tags can't be written into HTML attributes.
How are $Setup vars dealt with between packaging and its development orgs?